tracing: Add otel tracer transport to all http clients (#14972)

* Fixed otelhttp client setups.

Note: This may not be the best solution as the http client is defined in many places. There should be a canoncial http client with the proper setup.

* Changelog fragment

* go mod tidy and gazelle
This commit is contained in:
Preston Van Loon
2025-02-21 13:39:53 -06:00
committed by GitHub
parent 832ebb3f39
commit 9bceaa59d2
16 changed files with 41 additions and 6 deletions

View File

@@ -19,6 +19,7 @@ go_library(
"@com_github_prometheus_client_golang//prometheus:go_default_library",
"@com_github_prometheus_client_golang//prometheus/promauto:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
"@io_opentelemetry_go_contrib_instrumentation_net_http_otelhttp//:go_default_library",
],
)

View File

@@ -20,6 +20,7 @@ import (
"github.com/prysmaticlabs/prysm/v5/monitoring/tracing"
"github.com/prysmaticlabs/prysm/v5/monitoring/tracing/trace"
"github.com/sirupsen/logrus"
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
)
const (
@@ -56,7 +57,7 @@ func NewApiClient(baseEndpoint string) (*ApiClient, error) {
}
return &ApiClient{
BaseURL: u,
RestClient: &http.Client{},
RestClient: &http.Client{Transport: otelhttp.NewTransport(http.DefaultTransport)},
}, nil
}