feat: database_observability: stop tracking own instrumentation queries#4991
Merged
cristiangreco merged 2 commits intomainfrom Dec 16, 2025
Merged
Conversation
internal/component/database_observability/postgres/collector/query_samples.go
Show resolved
Hide resolved
d37df3f to
d8a065d
Compare
Contributor
|
💻 Deploy preview available (dbo11y: stop tracking alloy's own queries in |
4 tasks
d8a065d to
39091a0
Compare
pg_stat_activity
Contributor
|
💻 Deploy preview available (feat: database_observability: stop tracking own instrumentation queries): |
This PR introduces a change for excluding "own queries" in postgres from `pg_stat_activity`: we need to drop samples (and wait events) for the currently connected user. This new behaviour is enabled by default through the setting `exclude_current_user`, as it's deemed safe / recommended. No changes to be done on `pg_stat_statements` as that is achieved through user permissions update (docs on the website).
6f3ad1e to
5061da1
Compare
cristiangreco
commented
Dec 16, 2025
Comment on lines
+32
to
+39
| columns := []string{ | ||
| "now", "datname", "pid", "leader_pid", | ||
| "usename", "application_name", "client_addr", "client_port", | ||
| "backend_type", "backend_start", "backend_xid", "backend_xmin", | ||
| "xact_start", "state", "state_change", "wait_event_type", | ||
| "wait_event", "blocked_by_pids", "query_start", "query_id", | ||
| } | ||
|
|
Contributor
Author
There was a problem hiding this comment.
Drive-by change: I've tried to fix flakyness of these tests and make the style more consistent.
docs/sources/reference/components/database_observability/database_observability.postgres.md
Show resolved
Hide resolved
b44955e to
4e3c751
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Description
This PR introduces a change for excluding "own queries" in postgres from
pg_stat_activity: we need to drop samples (and wait events) for the currently connected user. This new behaviour is enabled by default through the settingexclude_current_user, as it's deemed safe / recommended.No changes to be done on
pg_stat_statementsas that is achieved through user permissions update (docs on the website).Which issue(s) this PR fixes
Relates to https://github.com/grafana/grafana-dbo11y-app/issues/1307
Notes to the Reviewer
PR Checklist
BEGIN_COMMIT_OVERRIDE
feat(database_observability): Stop tracking own instrumentation queries (#4991)
This PR introduces a change for excluding "own queries" in postgres from
pg_stat_activity: we need to drop samples (and wait events) for thecurrently connected user. This new behaviour is enabled by default
through the setting
exclude_current_user, as it's deemed safe /recommended.
No changes to be done on
pg_stat_statementsas that is achievedthrough user permissions update (docs on the website).
END_COMMIT_OVERRIDE