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

Sidekiq instrumentation not creating child spans with SDK 1.2.1 #544

Closed
bolandoboy opened this issue Jul 5, 2023 · 4 comments
Closed

Sidekiq instrumentation not creating child spans with SDK 1.2.1 #544

bolandoboy opened this issue Jul 5, 2023 · 4 comments
Labels
bug Something isn't working stale Marks an issue/PR stale

Comments

@bolandoboy
Copy link

bolandoboy commented Jul 5, 2023

Hi! I'm using the Sidekiq instrumentation with the option propagation_style: :child. This works fine with opentelemetry-sdk 1.2.0 but fails when upgrading to 1.2.1.

"Fails" here means that spans are not exported, tested with a minimal example using the console exporter.

Tracking down the problem, I think it all comes down to the same root cause of #535

  1. opentelemetry-sdk 1.2.1 introduced this check in OpenTelemetry::SDK::Trace::Tracer#start_span (MR here):

https://github.com/open-telemetry/opentelemetry-ruby/blob/1159ec04aa62168c6a841273401b71c325fa5986/sdk/lib/opentelemetry/sdk/trace/tracer.rb#L32

  1. In the Sidekiq instrumentation, unless you use the option trace_processor_process_one: true, the context is set as untraced:

  1. By the time the process span is going to be created, extracted_context is untraced. (Please note that for the default propagation_style: :link a new root span with its own context is created, and that works)

  1. So for child spans tracer.in_span is used, which ends up calling the SDK start_span from point 1, which follow the untraced branch and, long story short, ends up creating a OpenTelemetry::Trace::Span instead of an OpenTelemetry::SDK::Trace::Span

OpenTelemetry::Trace::Span does nothing on finish, and spans are silently dropped:

https://github.com/open-telemetry/opentelemetry-ruby/blob/1159ec04aa62168c6a841273401b71c325fa5986/api/lib/opentelemetry/trace/span.rb#L154

(Edit: Not sure why some links are showing as snippets and others as huge links, sorry about that)

@bolandoboy bolandoboy added the bug Something isn't working label Jul 5, 2023
kevinnio added a commit to kevinnio/opentelemetry-ruby-contrib that referenced this issue Jul 6, 2023
According to the discussion in open-telemetry#535, we can better match spec by
avoiding the `sidekiq::processor#process_one` span altogether. This
fixes the issues described in open-telemetry#535 and open-telemetry#544.
@arielvalentin
Copy link
Collaborator

@github-actions
Copy link
Contributor

👋 This issue has been marked as stale because it has been open with no activity. You can: comment on the issue or remove the stale label to hold stale off for a while, add the keep label to hold stale off permanently, or do nothing. If you do nothing this issue will be closed eventually by the stale bot.

@github-actions github-actions bot added the stale Marks an issue/PR stale label Aug 19, 2023
@KirillKayumov
Copy link

Upgrading to 'opentelemetry-instrumentation-sidekiq', '0.24.4' fixes the problem. Fix was added in #580

@github-actions github-actions bot removed the stale Marks an issue/PR stale label Aug 20, 2023
@github-actions
Copy link
Contributor

👋 This issue has been marked as stale because it has been open with no activity. You can: comment on the issue or remove the stale label to hold stale off for a while, add the keep label to hold stale off permanently, or do nothing. If you do nothing this issue will be closed eventually by the stale bot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale Marks an issue/PR stale
Projects
None yet
Development

No branches or pull requests

3 participants