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

fix: pass same context to Sampler and SpanProcessor in root span case #2790

Merged
merged 1 commit into from Feb 17, 2022

Conversation

Flarna
Copy link
Member

@Flarna Flarna commented Feb 16, 2022

Which problem is this PR solving?

Currently Sampler gets a different context then SpanProcessor in case option.root is set to true. This is inconsistent and besides that the SpanProcessor might end up in a wrong conclusion regarding parent span which is not intended.

Short description of the changes

If options.root is set the behavior is like no parent span is on context.
Delete a potential span from context and pass this new context to onStart() and shouldSample().

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • see added tests

Checklist:

  • Followed the style guidelines of this project
  • Unit tests have been added
  • Documentation has been updated

If options.root is set the behavior is like no parent span is on context.
Delete a potential span from context and pass this new context to onStart() and shouldSample().
@Flarna Flarna requested a review from a team as a code owner February 16, 2022 11:03
@Flarna Flarna added the bug Something isn't working label Feb 16, 2022
@codecov
Copy link

codecov bot commented Feb 16, 2022

Codecov Report

Merging #2790 (7eafa8e) into main (2da6754) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head 7eafa8e differs from pull request most recent head dedbaac. Consider uploading reports for the commit dedbaac to get more accurate results

@@            Coverage Diff             @@
##             main    #2790      +/-   ##
==========================================
- Coverage   93.43%   93.42%   -0.01%     
==========================================
  Files         159      159              
  Lines        5452     5449       -3     
  Branches     1145     1143       -2     
==========================================
- Hits         5094     5091       -3     
  Misses        358      358              
Impacted Files Coverage Δ
...ackages/opentelemetry-sdk-trace-base/src/Tracer.ts 98.38% <100.00%> (-0.08%) ⬇️

@dyladan dyladan merged commit eb19f3d into open-telemetry:main Feb 17, 2022
@Flarna Flarna deleted the ctx-onstart branch February 17, 2022 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants