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

@@ -78,6 +78,7 @@ go_library(
"@com_github_tyler_smith_go_bip39//:go_default_library",
"@com_github_tyler_smith_go_bip39//wordlists:go_default_library",
"@com_github_wealdtech_go_eth2_wallet_encryptor_keystorev4//:go_default_library",
"@io_opentelemetry_go_contrib_instrumentation_net_http_otelhttp//:go_default_library",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//codes:go_default_library",
"@org_golang_google_grpc//metadata:go_default_library",

View File

@@ -16,6 +16,7 @@ import (
nodeClientFactory "github.com/prysmaticlabs/prysm/v5/validator/client/node-client-factory"
validatorClientFactory "github.com/prysmaticlabs/prysm/v5/validator/client/validator-client-factory"
validatorHelpers "github.com/prysmaticlabs/prysm/v5/validator/helpers"
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
"google.golang.org/grpc"
)
@@ -55,7 +56,7 @@ func (s *Server) registerBeaconClient() error {
)
restHandler := beaconApi.NewBeaconApiJsonRestHandler(
http.Client{Timeout: s.beaconApiTimeout},
http.Client{Timeout: s.beaconApiTimeout, Transport: otelhttp.NewTransport(http.DefaultTransport)},
s.beaconApiEndpoint,
)