[receiver/postgresql] clarify postgresql.backends metric semantics - #49201
[receiver/postgresql] clarify postgresql.backends metric semantics#49201kartikgola wants to merge 16 commits into
postgresql.backends metric semantics#49201Conversation
|
Welcome, contributor! Thank you for your contribution to opentelemetry-collector-contrib. Important reminders:
|
postgresql.backends metric semantics
postgresql.backends metric semanticspostgresql.backends metric semantics
postgresql.backends metric semanticspostgresql.backends metric semantics
|
@kartikgola I think this is a helpful docs change, we can probably add the |
Resolve conflicts from main's OTel semconv feature-gate and query-conflicts work: keep the backendCountByDB rename alongside main's dbConflictStats field, and regenerate mdatagen output (metadata.yaml already merged cleanly) instead of hand-resolving the generated test file. Assisted-by: Claude Fable 5
| ### postgresql.backends | ||
|
|
||
| The number of backends. | ||
| The number of backend processes associated with each database, as reported by `pg_stat_activity`. Counts backends across all connection states (active, idle, idle-in-transaction) and all backend types, including non-client backends such as autovacuum and parallel workers. |
There was a problem hiding this comment.
I try to follow the rule of not disclosing the underlying datasoruce in documentation. How about:
"The number of backend processes associated with each database. Counts backends across all connection states (active, idle, idle-in-transaction) and all backend types, including non-client backends such as autovacuum and parallel workers." - {in all relevant places in the MR}
| GRANT pg_monitor TO otelu; | ||
| ``` | ||
|
|
||
| The `postgresql.backends` metric reports the number of PostgreSQL backend processes associated with each database, |
There was a problem hiding this comment.
The README paragraph is more of an extended explanation for users, and while it's debatable there, I'd still lean toward removing the explicit pg_stat_activity reference from the README too, since the review guidelines are clear about this.
There was a problem hiding this comment.
Agreed. The only reason it was added here was because of the presence of pg_stat_activity. It makes sense to remove it from here since its an internal detail.
There was a problem hiding this comment.
Heads up — the generated files (generated_package_test.go, generated_logs.go, generated_logs_test.go, generated_metrics.go, generated_resource_test.go) have import reordering where standard library packages ended up below third-party imports, which can cause CI lint failures.
What I do is run make generate from within receiver/postgresqlreceiver/ — that runs mdatagen and then applies gofumpt, goimports, and gci to fix import ordering automatically. If you only ran go generate ./... or make mdatagen, those formatting steps get skipped.
…#47853) Co-authored-by: Evan Bradley <11745660+evan-bradley@users.noreply.github.com> Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com>
Local mdatagen regeneration used a different import-grouping convention than the repo's pinned gci config; restore the standard grouping with no functional change.
Pull request dashboard statusStatus last refreshed: 2026-07-27 15:22:19 UTC.
This automated status or its linked feedback items may be incorrect. If something looks wrong, please report it with the result you expected. |
|
bumping this! |
…ql.backends description Assisted-by: Claude Sonnet 5
Description
client.gofileactivityMaptobackendCountByDBto make the intention clear since it has references where it's being used asif activeConnections, ok := r.activityMap[dbName];– assuming thatactivityMapalways contains active connections which might not be the case.Link to tracking issue
postgresql.backendsmetric is described only asThe number of backendswhich looks ambiguous #49200Testing
make testDocumentation
Updated
receiver/postgresqlreceiverdocumentation with the new definition.Authorship