Grafana 9.3 - usage of global variables in data source custom header

I’m trying to dynamically set values for X-Opaque-Id header in the requests sent to Elasticsearch.

In the data source configuration, I can add custom headers but how do I dynamically set the value of the header to be the login id of a user?

I tried using the global variables but they just resolve as literal strings.

${__user.id} is the ID of the current user. ${__user.login} is the login handle of the current user.

image

image

I agree but when I use ${__user.id} or ${__user.login} in a custom header of a data source, it does not resolve.

please share what you have, screen grab etc. not sure what data source you are using

Hi, this is what I mean. The data source is Elasticsearch data source.

1 Like

how do you know it resolves to literal string? are you seeing the actual traffic?

Yes, I checked what was received on the Elasticsearch end.

I would use infinity plugin instead of elastic search
it has a more robust way of sending headers.

https://localhost:3000/t/grafana-elastic-failed-to-display-node-graph/76117/4