diff --git a/pkg/gate/client.go b/pkg/gate/client.go index 14c21317..506012b5 100644 --- a/pkg/gate/client.go +++ b/pkg/gate/client.go @@ -27,7 +27,7 @@ func NewClient(baseURL string, opts ...ClientOption) (*Client, error) { client := &Client{ baseURL: url, options: &options{ - httpClient: opentelemetry.NewHttpClient(context.Background(), "GateClient"), + httpClient: opentelemetry.NewHttpClient("GateClient"), }, } for _, o := range opts { diff --git a/pkg/opentelemetry/init.go b/pkg/opentelemetry/init.go index 30693f36..bb6411e6 100644 --- a/pkg/opentelemetry/init.go +++ b/pkg/opentelemetry/init.go @@ -18,8 +18,6 @@ import ( "go.opentelemetry.io/otel/sdk/resource" sdktrace "go.opentelemetry.io/otel/sdk/trace" semconv "go.opentelemetry.io/otel/semconv/v1.20.0" - "google.golang.org/api/option" - "google.golang.org/api/transport" "google.golang.org/grpc/encoding/gzip" ) @@ -130,21 +128,12 @@ func initGlobalTracer(ctx context.Context, res *resource.Resource, cfg Config) ( }, nil } -func NewHttpClient(ctx context.Context, name string, opts ...option.ClientOption) *http.Client { +func NewHttpClient(name string) *http.Client { otelOpts := []otelhttp.Option{ otelhttp.WithSpanNameFormatter(func(operation string, r *http.Request) string { return fmt.Sprintf("%s %s", name, operation) }), } - if len(opts) > 0 { - credsClient, _, err := transport.NewHTTPClient(ctx, opts...) - if err != nil { - return nil - } - - credsClient.Transport = otelhttp.NewTransport(credsClient.Transport, otelOpts...) - return credsClient - } return &http.Client{ Transport: otelhttp.NewTransport(http.DefaultTransport, otelOpts...), diff --git a/plugins/providers/bigquery/provider_test.go b/plugins/providers/bigquery/provider_test.go index 5db36294..24b7efae 100644 --- a/plugins/providers/bigquery/provider_test.go +++ b/plugins/providers/bigquery/provider_test.go @@ -1107,7 +1107,7 @@ func (s *BigQueryProviderTestSuite) TestListAccess() { }, }, []*domain.Resource{}) - s.EqualError(err, "initializing bigquery client: invalid character 'i' looking for beginning of value") + s.EqualError(err, "initializing bigquery client: failed to obtain credentials: invalid character 'i' looking for beginning of value") }) s.Run("return nil error on success", func() { diff --git a/plugins/providers/grafana/client.go b/plugins/providers/grafana/client.go index 5c637429..9928b104 100644 --- a/plugins/providers/grafana/client.go +++ b/plugins/providers/grafana/client.go @@ -2,7 +2,6 @@ package grafana import ( "bytes" - "context" b64 "encoding/base64" "encoding/json" "fmt" @@ -63,7 +62,7 @@ func NewClient(config *ClientConfig) (*client, error) { httpClient := config.HTTPClient if httpClient == nil { - httpClient = opentelemetry.NewHttpClient(context.Background(), "GrafanaHttpClient", nil) + httpClient = opentelemetry.NewHttpClient("GrafanaHttpClient") } baseURL, err := url.Parse(config.Host) diff --git a/plugins/providers/metabase/client.go b/plugins/providers/metabase/client.go index b88d63dc..c3531b19 100644 --- a/plugins/providers/metabase/client.go +++ b/plugins/providers/metabase/client.go @@ -143,7 +143,7 @@ func NewClient(config *ClientConfig, logger log.Logger) (*client, error) { httpClient := config.HTTPClient if httpClient == nil { - httpClient = opentelemetry.NewHttpClient(context.Background(), "MetabaseHttpClient", nil) + httpClient = opentelemetry.NewHttpClient("MetabaseHttpClient") } c := &client{ diff --git a/plugins/providers/shield/client.go b/plugins/providers/shield/client.go index 9bc2b1ed..f4fed008 100644 --- a/plugins/providers/shield/client.go +++ b/plugins/providers/shield/client.go @@ -78,7 +78,7 @@ func NewClient(config *ClientConfig, logger log.Logger) (*client, error) { httpClient := config.HTTPClient if httpClient == nil { - httpClient = opentelemetry.NewHttpClient(context.Background(), "ShieldHttpClient", nil) + httpClient = opentelemetry.NewHttpClient("ShieldHttpClient") } c := &client{ diff --git a/plugins/providers/tableau/client.go b/plugins/providers/tableau/client.go index fa96a4fd..764e0e84 100644 --- a/plugins/providers/tableau/client.go +++ b/plugins/providers/tableau/client.go @@ -2,7 +2,6 @@ package tableau import ( "bytes" - "context" "encoding/json" "errors" "fmt" @@ -604,7 +603,7 @@ func NewClient(config *ClientConfig) (*client, error) { httpClient := config.HTTPClient if httpClient == nil { - httpClient = opentelemetry.NewHttpClient(context.Background(), "TableauHttpClient", nil) + httpClient = opentelemetry.NewHttpClient("TableauHttpClient") } c := &client{