Skip to content

internal/tracer: use dynamic WrappedTracerProvider to correctly set Tracer names

Administrator requested to merge otel-bridge-tracer-names into main

Created by: bobheadxi

The existing wrapped OpenTelemetry TracerProvider for bridging OpenTracing API calls to OpenTelemetryAPI calls discards the name provided to the Tracer() constructor on it, since it uses a fixed tracer that we provide it.

This change leverages an upstream patch, https://github.com/open-telemetry/opentelemetry-go/pull/3116, that allows wrapped tracers to be created on the fly with the provided parameters, so that we can more accurately see the instrumentation source.

Opening for review, but leaving as draft in case upstream maintainers call out something seriously wrong with this approach.

Test plan

Via the bridge, we can see that the Tracer used is the bridge tracer:

image

Via direct usage of OpenTelemetry, we can see that the Tracer used has the custom name set:

image

Merge request reports

Loading