Skip to content

Add per db metrics #4183

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

benjaminjb
Copy link
Contributor

Checklist:

  • Have you added an explanation of what your changes do and why you'd like them to be included?
  • Have you updated or added documentation for the change, as applicable?
  • Have you tested your changes on all related environments with successful results, as applicable?
    • Have you added automated tests?

Type of Changes:

  • New feature
  • Bug fix
  • Documentation
  • Testing enhancement
  • Other

What is the current behavior (link to any open issues here)?

No per-db metrics

What is the new behavior (if this is a feature change)?

  • Breaking change (fix or feature that would cause existing functionality to change)

  • Add per-db metrics (based on pgMonitor v5.2.1)

  • Allow per-db custom metrics

Other Information:
Issues: [PGO-21]

@benjaminjb benjaminjb changed the title Benjb/per db metrics Add per db metrics May 19, 2025
@benjaminjb benjaminjb marked this pull request as ready for review May 20, 2025 15:21
@benjaminjb
Copy link
Contributor Author

Some notes on this PR:

  • I based the per db metrics on pgmonitor 5.2.1, which Drew is bumping to elsewhere
  • some per db metrics were already included in internal/collector/gte_pg16_slow_metrics.yaml/internal/collector/lt_pg16_slow_metrics.yaml, so I moved them over to the per db metric list; this let me delete those files and update some of the logic for adding metrics
  • I added steps to our OTel KUTTL test (beginning to strain at the bounds of a reasonable test, might break up in the future) to test the different functionality added: targeting certain dbs with the defaults; removing metrics from the defaults; adding custom per db metrics.

@@ -2165,6 +2170,12 @@ spec:
type: string
type: array
type: object
perDBMetricTargets:
Copy link
Member

@cbandy cbandy May 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 IIUC, this and customQueries only make sense at/on Postgres. Is there a way to arrange structs so the PGAdmin API doesn't have these fields? Not a blocker; v1beta1.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't want to make any too big changes with the spec, but I wonder if the pgadmin and postgrescluster versions will diverge even more (or if we'll eventually want to slice up instrumentation by target-type, eg., postgres-instrumentation, pgbouncer-instrumentation, pgadmin-instrumentation).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm yeah good point... Probably makes sense to at least have a pgadmin-instrumentation and a postgrescluster-instrumentation and then pick and choose which structs make sense in each

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants