Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance tuning PQL queries #366

Closed
tuxmea opened this issue Apr 25, 2024 · 1 comment · Fixed by #381
Closed

Performance tuning PQL queries #366

tuxmea opened this issue Apr 25, 2024 · 1 comment · Fixed by #381
Assignees
Labels
enhancement New feature or request

Comments

@tuxmea
Copy link
Member

tuxmea commented Apr 25, 2024

At the moment we use inventory API endpoint.

We need to query PuppetDB for three different data:

  1. environments
  2. certnames
  3. facts for a given certname

Environments API endpoint: https://www.puppet.com/docs/puppetdb/8/api/query/v4/environments
Certname Endpoint: https://www.puppet.com/docs/puppetdb/8/api/query/v4/nodes
Facts Endpoint: https://www.puppet.com/docs/puppetdb/8/api/query/v4/nodes#pdbqueryv4nodesnodefacts

@tuxmea tuxmea added the enhancement New feature or request label Apr 25, 2024
@oneiros
Copy link
Collaborator

oneiros commented May 22, 2024

Just in case anyone can provide an answer quickly:

The inventory endpoint currently provides us with definitive environment for every node. Turns out the nodes endpoint gives us three instead: catalog_environment, facts_environment and report_environment. I wonder which one should we use?

I am pretty sure we can discard report_environment, which is nil in some examples I have seen. In the same examples catalog_environment and facts_environment are the same. I suspect this is often the case, but probably not always. I also suspect that when they differ we are looking at edge cases where sometimes one is better than the other for our purposes, but there are also cases where it is the other way around.

I am tending towards just using catalog_environment as this should, as far as I understand it, reflect the environment that is currently applied to the node. If the actual environment changed on the node, no new catalog has been applied since then and I believe there is no guarantee that facts_environment will include newer information (though it might 🤷‍♂️).

oneiros added a commit that referenced this issue May 22, 2024
`nodes` should be faster than `inventory`.
tuxmea added a commit that referenced this issue Oct 22, 2024
`nodes` should be faster than `inventory`.

Co-authored-by: Martin Alfke <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants