feat: enable cross-app distributed tracing for v2 APIs (#11453)

This commit is contained in:
Mridang Agarwalla
2026-02-03 13:36:29 +01:00
committed by GitHub
parent d51d615e97
commit 6363ee0d0a
6 changed files with 20 additions and 4 deletions
+7 -2
View File
@@ -110,6 +110,7 @@ func New(
accessInterceptor *http_mw.AccessInterceptor,
targetEncryptionAlgorithm crypto.EncryptionAlgorithm,
translator *i18n.Translator,
trustRemoteSpans bool,
) (_ *API, err error) {
api := &API{
port: port,
@@ -132,12 +133,16 @@ func New(
if err != nil {
return nil, err
}
api.connectOTELInterceptor, err = otelconnect.NewInterceptor(
otelOpts := []otelconnect.Option{
otelconnect.WithTracerProvider(otel.GetTracerProvider()),
otelconnect.WithMeterProvider(otel.GetMeterProvider()),
otelconnect.WithPropagator(otel.GetTextMapPropagator()),
otelconnect.WithoutServerPeerAttributes(),
)
}
if trustRemoteSpans {
otelOpts = append(otelOpts, otelconnect.WithTrustRemote())
}
api.connectOTELInterceptor, err = otelconnect.NewInterceptor(otelOpts...)
if err != nil {
return nil, err
}