clickhouse-grafana
clickhouse-grafana copied to clipboard
Add identifying metadata on requests to the ClickHouse query log
It would be very useful to have more information of the Grafana client requests in the ClickHouse query log. This will help pinpoint those panels and users which are hitting ClickHouse backends particularly heavily.
Primarily:
- Grafana user
- Panel or template variable definition which initiated the query
- Grafana query ID
Seems like the log_comment column in system.query_log could be used for storing this in JSON, although the http_referer might be more appropriate for the panel.
we need to figure out and ensure could grafana core pass some metadata in headers we easily can add required metadata in query body with comment
There are global variables in grafana, can them be used here?
https://grafana.com/docs/grafana/v8.5/variables/variable-types/global-variables/#__user
Also available other
https://grafana.com/docs/grafana/latest/dashboards/variables/add-template-variables/#__dashboard
better will implement option in QueryEditor
like
"send metadata" which will add comment in request with /* $__dashboard $__user */
and turn on it by default