opentelemetry-go icon indicating copy to clipboard operation
opentelemetry-go copied to clipboard

OpenTracing bridge: BridgeTracer.Inject errors with ErrInvalidCarrier

Open kvrhdn opened this issue 2 years ago • 1 comments

Description

We are migrating our OpenTracing app to OpenTelemetry using the OpenTracing bridge. Unfortunately tracer.Inject is failing with ErrInvalidCarrier despite providing a valid HTTPHeaders carrier.

The code:

Is this a known limitation of the OpenTracing bridge?

I'd guess to solve this we'd need some kind of adapter from the OpenTracing TextMapWriter into OTel's TextMapCarrier. I see Inject only calls Set so maybe we can get away with only implementing that function?

Environment

  • opentelemetry-go version: v1.0.0-RC2
  • github.com/opentracing/opentracing-go: v1.2.0

Steps To Reproduce

  1. Use BridgeTracer from the OpenTracing bridge
  2. Inject a carrier with format HTTPHeaders that implements TextMapWriter but is not of type HTTPHeadersCarrier

Expected behavior

The BridgeTracer.Inject should accept a carrier of type TextMapWriter.

kvrhdn avatar Jul 28 '21 09:07 kvrhdn

I started working on this.

bboreham avatar Jul 28 '21 10:07 bboreham