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

[Feature]: For each metric to be collected define a mechanism to check if the query needs to be executed or not #4499

Closed
2 tasks done
gabrosys opened this issue May 9, 2024 · 0 comments
Assignees
Labels
triage Pending triage

Comments

@gabrosys
Copy link
Contributor

gabrosys commented May 9, 2024

Is there an existing issue already for this feature request/idea?

  • I have searched for an existing issue, and could not find anything. I believe this is a new feature request to be evaluated.

What problem is this feature going to solve? Why should it be added?

Postgres is a database that is prone to be extended via plugins and extensions. Would be great to define metrics that will be collected only if certain conditions in the database are verified.
Some scenario where this could be applied:

  • Extension dependent queries.
  • Extension version-dependent queries.
  • Pg flavour dependent queries (new col in the system view, new func added, new system view added etc).
  • Enabling queries dynamically when a customer installs an optional extension.
  • Supporting changing the PGD database name since we can detect the extension instead of relying on a pattern matching the DB name.
  • Metrics that are conditional on runtime state.scenarios

Describe the solution you'd like

Implement a new property along the query that is named predicate_query. This property is used to execute a query in the same context as the one to collect the metrics.
The logic applied should be something like:

  • predicate_query empty -> true executes the query to collect the metrics.
  • predicate_query not empty -> execute the query and evaluate the result. Behave accordingly to execute or not the query for the metrics.

Describe alternatives you've considered

Update the query property definition to deliver an array of queries where an error on the first blocks the executions of the next.

Additional context

The need for this feature is also related to an issue with PG that does not allow execution in a single statement of more than one query. Also, using the DO we are not able to get in return a table with a single statement and so we need to end up with something that executes another query to achieve what we need.

Backport?

N/A

Are you willing to actively contribute to this feature?

Yes

Code of Conduct

  • I agree to follow this project's Code of Conduct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage Pending triage
Projects
None yet
Development

No branches or pull requests

2 participants