Conversation
SpencerTorres
left a comment
There was a problem hiding this comment.
Thanks! This is our best available solution until we can get metadata on the query log table.
|
Still concerned with how complex dashboard names may be parsed, but this is still pretty good. I'm not sure if it's the standard for client info but maybe we could try to protect it with |
|
This is great! Thanks for adding this @MattiasMTS . One small request: Can the |
IIUC, this is only logging IDs, not names. |
cbd33f8 to
0afe662
Compare
Done! Thanks ✨ |
Type of Change
Please check the relevant option.
Feature
Adds Grafana dashboard UID and panel ID metadata to ClickHouse query logs by extending the existing ClientInfo.Comment mechanism.
When a query is executed from a Grafana dashboard panel, the ClickHouse system.query_log.client_name column now includes:
grafana-clickhouse/4.x.x clickhouse-go/2.43.0 (grafana_user:admin; grafana_dashboard:abc123; grafana_panel:42; lv:go/1.22; os:linux)
This is implemented by:
Who is this feature for?
When running ClickHouse as a Grafana datasource, it's currently impossible to identify which dashboard or panel is generating expensive or slow queries. The only metadata available in
system.query_log is the Grafana username (added in a prior PR). This makes it difficult to:
This is especially critical for shared ClickHouse read replicas serving multiple Grafana dashboards, where a single heavy panel can starve other queries.
How to test this feature
Provide step-by-step instructions for reviewers to test the feature.
Bug Fix
If this is a bug fix, please complete this section. Otherwise, delete it.
What is the bug?
Provide a clear and concise description of the bug.
How to reproduce
Provide step-by-step instructions to reproduce the bug.
Related Issues
Link to any open issues this PR will close. Use "Closes #123" or "Fixes #123" syntax.
Closes #
Environment (if no related issue)
If there is no open issue, please specify the versions where the bug occurs.
Screenshots / Videos
Please provide screenshots or videos demonstrating the bug or the feature working. This helps reviewers understand the change visually and speeds up the review process.
Please check that:
Special notes for your reviewer
ClientInfo.Commentis protocol-agnostic (native: client_name column, HTTP: http_user_agent column in system.query_log)