Prometheus: Use contextual middleware for req headers and simplify client creation (#51061)

* Use contextual middleware and simplify client creation

* Fix tests

* Add test for the header propagation

* Fix tests and lint

* Update pkg/tsdb/prometheus/prometheus.go

Co-authored-by: ismail simsek <ismailsimsek09@gmail.com>

Co-authored-by: ismail simsek <ismailsimsek09@gmail.com>
This commit is contained in:
Andrej Ocenas
2022-06-23 14:48:16 +02:00
committed by GitHub
co-authored by ismail simsek
parent a8eb29f1d7
commit d20afa2a39
17 changed files with 394 additions and 697 deletions
+4
View File
@@ -45,6 +45,10 @@ func (provider *fakeHTTPClientProvider) New(opts ...sdkHttpClient.Options) (*htt
return client, nil
}
func (provider *fakeHTTPClientProvider) GetTransport(opts ...sdkHttpClient.Options) (http.RoundTripper, error) {
return &fakeRoundtripper{}, nil
}
func TestClient(t *testing.T) {
t.Run("Service", func(t *testing.T) {
t.Run("CallResource", func(t *testing.T) {