From 0e5a117619286b88179ced0b0c40c81dda226445 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Wed, 5 Apr 2023 12:04:35 +0200 Subject: [PATCH] feat: support OTel tracing in gateway with correct propagators --- core/corehttp/gateway.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/corehttp/gateway.go b/core/corehttp/gateway.go index aed8603685d..8ba61306086 100644 --- a/core/corehttp/gateway.go +++ b/core/corehttp/gateway.go @@ -21,6 +21,7 @@ import ( config "github.com/ipfs/kubo/config" core "github.com/ipfs/kubo/core" "github.com/ipfs/kubo/core/node" + "github.com/ipfs/kubo/tracing" "github.com/libp2p/go-libp2p/core/routing" id "github.com/libp2p/go-libp2p/p2p/protocol/identify" "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" @@ -50,9 +51,7 @@ func GatewayOption(paths ...string) ServeOption { } gw := gateway.NewHandler(gwConfig, gwAPI) - // TODO: Add otelhttp.WithPropagators(tracing.Propagator()) option to - // propagate traces through the gateway once we test this feature. - gw = otelhttp.NewHandler(gw, "Gateway.Request") + gw = otelhttp.NewHandler(gw, "Gateway", otelhttp.WithPropagators(tracing.Propagator())) // By default, our HTTP handler is the gateway handler. handler := gw.ServeHTTP