-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[receiver/postgresql] add basic query sample collection for postgresqlreceiver #39573
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
Conversation
…tor-contrib into top-queries
…ector-contrib into top-queries
|
||
p.collectTopQuery(ctx, dbClient, &logRecords, maxRowsPerQuery, topNQuery, &errs, p.logger) | ||
|
||
defer dbClient.Close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should the defer call be before we collect?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Some small things to address.
Moving to draft, please address comments and mark ready for review. |
…tor-contrib into top-queries
…lreceiver (open-telemetry#39573) #### Description we introduced the top query collection to postgresql receiver. this will collect the queries from `pg_stat_statements` and report the related metrics. this will help the end user to identify which queries are most executed, and resources most used. Example output: ``` resourceLogs: - resource: attributes: [] scopeLogs: - logRecords: - attributes: - key: db.system.name value: stringValue: postgresql - key: db.namespace value: stringValue: postgres - key: db.query.text value: stringValue: "select * from pg_stat_activity where id = ?" - key: postgresql.calls value: intValue: 3 - key: postgresql.rows value: intValue: 10 - key: postgresql.shared_blks_dirtied value: intValue: 1 - key: postgresql.shared_blks_hit value: intValue: 2 - key: postgresql.shared_blks_read value: intValue: 3 - key: postgresql.shared_blks_written value: intValue: 4 - key: postgresql.temp_blks_read value: intValue: 5 - key: postgresql.temp_blks_written value: intValue: 6 - key: postgresql.queryid value: stringValue: "114514" - key: postgresql.rolname value: stringValue: master - key: postgresql.total_exec_time value: doubleValue: 1 - key: postgresql.total_plan_time value: doubleValue: 1 body: stringValue: top query scope: name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/postgresqlreceiver version: 0.0.1 ```
…lreceiver (open-telemetry#39573) #### Description we introduced the top query collection to postgresql receiver. this will collect the queries from `pg_stat_statements` and report the related metrics. this will help the end user to identify which queries are most executed, and resources most used. Example output: ``` resourceLogs: - resource: attributes: [] scopeLogs: - logRecords: - attributes: - key: db.system.name value: stringValue: postgresql - key: db.namespace value: stringValue: postgres - key: db.query.text value: stringValue: "select * from pg_stat_activity where id = ?" - key: postgresql.calls value: intValue: 3 - key: postgresql.rows value: intValue: 10 - key: postgresql.shared_blks_dirtied value: intValue: 1 - key: postgresql.shared_blks_hit value: intValue: 2 - key: postgresql.shared_blks_read value: intValue: 3 - key: postgresql.shared_blks_written value: intValue: 4 - key: postgresql.temp_blks_read value: intValue: 5 - key: postgresql.temp_blks_written value: intValue: 6 - key: postgresql.queryid value: stringValue: "114514" - key: postgresql.rolname value: stringValue: master - key: postgresql.total_exec_time value: doubleValue: 1 - key: postgresql.total_plan_time value: doubleValue: 1 body: stringValue: top query scope: name: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/postgresqlreceiver version: 0.0.1 ```
Description
we introduced the top query collection to postgresql receiver. this will collect the queries from
pg_stat_statements
and report the related metrics. this will help the end user to identify which queries are most executed, and resources most used.Example output: