Elasticsearch: Set middlewares from Grafana's `httpClientProvider` (#81814)

Elasticsearch: Set middlewares from httpClientProvider
pull/81950/head
Sven Grossmann 1 year ago committed by GitHub
parent 2d25ce8aab
commit bd48c06f95
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 3
      pkg/tsdb/elasticsearch/elasticsearch.go

@ -16,6 +16,7 @@ import (
"github.com/grafana/grafana-plugin-sdk-go/backend"
"github.com/grafana/grafana-plugin-sdk-go/backend/datasource"
sdkhttpclient "github.com/grafana/grafana-plugin-sdk-go/backend/httpclient"
"github.com/grafana/grafana-plugin-sdk-go/backend/instancemgmt"
exphttpclient "github.com/grafana/grafana-plugin-sdk-go/experimental/errorsource/httpclient"
@ -88,6 +89,8 @@ func newInstanceSettings(httpClientProvider httpclient.Provider) datasource.Inst
httpCliOpts.SigV4.Service = "es"
}
// set the default middlewars from the httpClientProvider
httpCliOpts.Middlewares = httpClientProvider.(*sdkhttpclient.Provider).Opts.Middlewares
// enable experimental http client to support errors with source
httpCli, err := exphttpclient.New(httpCliOpts)
if err != nil {

Loading…
Cancel
Save