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

[opentracing-shim] Provide span for opentracing shim inject

Open karusher opened this issue 1 year ago • 2 comments
trafficstars

We noticed that the propagation headers were not being populated correctly when using the opentracing-shim. The trace-id, span-id and trace flags were missing.

The various propagation injectors will attempt to retrieve the Span from the context that is provided in the api call:

void Inject(context::propagation::TextMapCarrier &carrier, const context::Context &context) noexcept override

The shim will provide the RuntimeContext augmented with the baggage to the Inject method. Unfortunately, the shim does not add the span to the RuntimeContext. It does not instantiate a Scope.

This commit adds a Span to the context passed into Inject by modifying the shim.

Fixes # (issue)

Changes

Please provide a brief description of the changes here.

For significant contributions please make sure you have completed the following items:

  • [X] CHANGELOG.md updated for non-trivial changes
  • [X] Unit tests have been added
  • [X] Changes in public API reviewed

karusher avatar Feb 15 '24 14:02 karusher

cc @chusitoo

marcalff avatar Feb 19 '24 16:02 marcalff

cc @chusitoo

Not a subject matter expert, but this looks like a very valid fix IMHO, and it is more or less equivalent to how the Java folks do it for their OT shim too.

chusitoo avatar Feb 21 '24 14:02 chusitoo