mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Elasticsearch: Set middlewares from Grafana's httpClientProvider
(#81814)
Elasticsearch: Set middlewares from httpClientProvider
This commit is contained in:
parent
2d25ce8aab
commit
bd48c06f95
@ -16,6 +16,7 @@ import (
|
|||||||
|
|
||||||
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
||||||
"github.com/grafana/grafana-plugin-sdk-go/backend/datasource"
|
"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"
|
"github.com/grafana/grafana-plugin-sdk-go/backend/instancemgmt"
|
||||||
exphttpclient "github.com/grafana/grafana-plugin-sdk-go/experimental/errorsource/httpclient"
|
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"
|
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
|
// enable experimental http client to support errors with source
|
||||||
httpCli, err := exphttpclient.New(httpCliOpts)
|
httpCli, err := exphttpclient.New(httpCliOpts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user