Plugins: Pass through dashboard/contextual HTTP headers to plugins/datasources (#60301)

`X-Dashboard-Uid`, `X-Datasource-Uid`, `X-Grafana-Org-Id`, `X-Panel-Id` are very useful headers set
by Grafana front-end that we would like to see on the data source as
well. This is so that it would be possible to pinpoint from where slow
queries are coming in Mimir/Thanos/Cortex/etc., for example. Relevant
Mimir code lines:
https://github.com/grafana/mimir/blob/0a94f26203cae7c1784a6d3040ccddb6c2063de9/pkg/frontend/transport/handler.go#L182-L184

Tested manually that with these changes the headers are visible.
This commit is contained in:
Giedrius Statkevičius authored and GitHub committed 2022-12-22 11:15:00 +01:00
1 parent b28a208926
commit 0485cf34cd
3 files changed
+247

No files matched your search

@@ -72,6 +72,7 @@ func NewClientDecorator(cfg *setting.Cfg, pCfg *config.Cfg,
func CreateMiddlewares(cfg *setting.Cfg, oAuthTokenService oauthtoken.OAuthTokenService) []plugins.ClientMiddleware {
skipCookiesNames := []string{cfg.LoginCookieName}
middlewares := []plugins.ClientMiddleware{
clientmiddleware.NewTracingHeaderMiddleware(),
clientmiddleware.NewClearAuthHeadersMiddleware(),
clientmiddleware.NewOAuthTokenMiddleware(oAuthTokenService),
clientmiddleware.NewCookiesMiddleware(skipCookiesNames),