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

feat: simplify active span logic #1589

Merged
merged 4 commits into from
Oct 14, 2020

Conversation

mwear
Copy link
Member

@mwear mwear commented Oct 10, 2020

Which problem is this PR solving?

Short description of the changes

This PR simplifies the active span logic by only storing a span in the active context. Instead of storing plain span contexts in a context, they are wrapped in a NoopSpan on extract.

  • The setExtractedSpanContext API method was updated to wrap the extracted span context in a NoopSpan before storing it in a context.
  • The getExtractedSpanContext method was removed, as this should now be done by accessing the context of the current span.
  • Logic in the http plugin had to be adjusted to preserve the require parent behavior.

cc: @vmarchaud - This work might be a prerequisite for #1552.

@mwear mwear added release:required-for-ga size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 10, 2020
@codecov
Copy link

codecov bot commented Oct 10, 2020

Codecov Report

Merging #1589 into master will increase coverage by 0.03%.
The diff coverage is 90.90%.

@@            Coverage Diff             @@
##           master    #1589      +/-   ##
==========================================
+ Coverage   91.41%   91.44%   +0.03%     
==========================================
  Files         165      165              
  Lines        5055     5052       -3     
  Branches     1035     1034       -1     
==========================================
- Hits         4621     4620       -1     
+ Misses        434      432       -2     
Impacted Files Coverage Δ
packages/opentelemetry-api/src/context/context.ts 90.00% <66.66%> (+6.66%) ⬆️
packages/opentelemetry-api/src/trace/NoopTracer.ts 100.00% <100.00%> (ø)
packages/opentelemetry-plugin-http/src/http.ts 97.28% <100.00%> (+0.01%) ⬆️
...ackages/opentelemetry-shim-opentracing/src/shim.ts 87.70% <100.00%> (ø)

Copy link
Member

@obecny obecny left a comment

Choose a reason for hiding this comment

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

lgtm - I think there is one typo

packages/opentelemetry-api/src/context/context.ts Outdated Show resolved Hide resolved
mwear and others added 4 commits October 13, 2020 18:07
This method doesn't really make sense since we wrap a span context
in a span on extract. Getting the context from the current span
is preferred replacement.
Co-authored-by: Bartlomiej Obecny <bobecny@gmail.com>
@dyladan dyladan added this to In progress PRs in GA Burndown via automation Oct 14, 2020
@dyladan dyladan merged commit 1c27690 into open-telemetry:master Oct 14, 2020
GA Burndown automation moved this from In progress PRs to Done Oct 14, 2020
dyladan pushed a commit to dyladan/opentelemetry-js that referenced this pull request Sep 9, 2022
Co-authored-by: Bartlomiej Obecny <bobecny@gmail.com>
dyladan pushed a commit to dyladan/opentelemetry-js that referenced this pull request Sep 9, 2022
Co-authored-by: Bartlomiej Obecny <bobecny@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
No open projects
GA Burndown
  
Done
Development

Successfully merging this pull request may close these issues.

wrap extracted span context in a propagate only span
4 participants