Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[opentracing-shim] Provide span for opentracing shim inject #2535

Merged
merged 3 commits into from
Feb 26, 2024

Conversation

karusher
Copy link
Contributor

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:

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

@karusher karusher requested a review from a team February 15, 2024 14:48
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.
@marcalff
Copy link
Member

cc @chusitoo

@chusitoo
Copy link
Contributor

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.

@marcalff marcalff changed the title Provide span for opentracing shim inject [opentracing-shim] Provide span for opentracing shim inject Feb 23, 2024
Copy link
Member

@marcalff marcalff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix.

@esigo esigo merged commit 84e38b2 into open-telemetry:main Feb 26, 2024
47 checks passed
malkia added a commit to malkia/opentelemetry-cpp that referenced this pull request Feb 27, 2024
Provide span for opentracing shim inject (open-telemetry#2535)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants