Format Referer header on X-Dashboard-Title and X-Panel-Title#1433
Format Referer header on X-Dashboard-Title and X-Panel-Title#1433velom wants to merge 2 commits intografana:mainfrom
Conversation
|
Hi @adamyeats, any ETA here? |
SpencerTorres
left a comment
There was a problem hiding this comment.
I like this, but is it possible to use the array-like behavior of the headers to add more data? I want to make it easier to fetch this out of the query log. The string formatting works, but I'm wondering if we can make it more HTTP-compliant
What I mean is, is it possible where the header can have multiple entries? I forgot the interface in Go, but there should be a way to do that
|
There is one global problem: Grafana doesn't pass most of headers to the datasource plugin, only few number of them, and there are no common HTTP headers. I can adjust the header handler and make it configurable:
E.g. instead of
What do you think? |
SpencerTorres
left a comment
There was a problem hiding this comment.
I suppose this is better than what we have now, I just wish we had a better way to attach metadata to queries. This doesn't apply to TCP connections does it?
| if dashboard != "" || panel != "" { | ||
| httpHeaders[headerReferer] = fmt.Sprintf("Dashboard title: %q, panel title: %q", dashboard, panel) | ||
| } else { | ||
| httpHeaders[headerReferer] = "Explorer" |
There was a problem hiding this comment.
This is technically untrue; the query could also come from alerting. You should be able to validate this by checking the uname from the plugin context for grafana_scheduler.
aangelisc
left a comment
There was a problem hiding this comment.
Generally this LGTM. I wonder if we should have this configurable - I'm not sure all users would want this enabled, wdyt?
|
Sure, sounds reasonable. |
|
Hi @velom 😊 sorry for the delay here. Are you able to update this PR based on my feedback? I believe this should be configurable to allow users to disable it if they wish. I think this should be disabled by default. Also, we should correctly identify alerting queries. |
The plugin can forward HTTP headers.
Unfortunately, ClickHouse stores only
Refererheader in thesystem.query_log.This PR adds additional header
Refererbased onX-Dashboard-TitleandX-Panel-Title.Examle of how it looks in the
query_log: