-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[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
base: main
Are you sure you want to change the base?
Conversation
…tor-contrib into top-queries
…ector-contrib into top-queries
|
||
scopedLog := resourceLog.ScopeLogs().AppendEmpty() | ||
scopedLog.Scope().SetName(metadata.ScopeName) | ||
scopedLog.Scope().SetVersion("0.0.1") |
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.
is that version correct?
DbAttributePrefix = "postgresql." | ||
QueryidColumnName = "queryid" | ||
TotalExecTimeColumnName = "total_exec_time" | ||
TotalPlanTimeColumnName = "total_plan_time" | ||
CallsColumnName = "calls" | ||
RowsColumnName = "rows" | ||
SharedBlksDirtiedColumnName = "shared_blks_dirtied" | ||
SharedBlksHitColumnName = "shared_blks_hit" | ||
SharedBlksReadColumnName = "shared_blks_read" | ||
SharedBlksWrittenColumnName = "shared_blks_written" | ||
TempBlksReadColumnName = "temp_blks_read" | ||
TempBlksWrittenColumnName = "temp_blks_written" |
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.
do they need to be exported?
|
||
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?
mux.addPartial(err) | ||
logger.Error("failed to read attributes from row", zap.Error(err)) | ||
} | ||
record.Attributes().PutStr("db.system.name", "postgresql") |
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.
shouldn't this be a resource attribute?
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.
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: