opentelemetry-cpp
opentelemetry-cpp copied to clipboard
[opentracing-shim] Provide span for opentracing shim inject
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.mdupdated for non-trivial changes - [X] Unit tests have been added
- [X] Changes in public API reviewed
cc @chusitoo
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.