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

[API] Create root span with active span #2427

Merged
merged 11 commits into from
Dec 5, 2023

Conversation

lalitb
Copy link
Member

@lalitb lalitb commented Dec 4, 2023

Fixes #2413

Changes

A safe ABIv1 approach (non-ABI/non-API breaking) I can think of - passing Context with ("is_root_span", true) value.

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

@lalitb lalitb requested a review from a team December 4, 2023 19:48
@lalitb lalitb changed the title [For discussion] Create root span when active span is active [For discussion] Create root span when active span Dec 4, 2023
@lalitb lalitb changed the title [For discussion] Create root span when active span [For discussion] Create root span with active span Dec 4, 2023
Copy link

codecov bot commented Dec 4, 2023

Codecov Report

Merging #2427 (e044771) into main (d91e5ba) will decrease coverage by 0.00%.
The diff coverage is 85.72%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2427      +/-   ##
==========================================
- Coverage   87.06%   87.06%   -0.00%     
==========================================
  Files         199      199              
  Lines        6080     6087       +7     
==========================================
+ Hits         5293     5299       +6     
- Misses        787      788       +1     
Files Coverage Δ
sdk/src/trace/tracer.cc 80.00% <100.00%> (+0.84%) ⬆️
api/include/opentelemetry/trace/context.h 91.67% <80.00%> (-8.33%) ⬇️

@marcalff
Copy link
Member

marcalff commented Dec 4, 2023

As discussed in SIG meeting, the fix principle looks ok.
The doc (comments) will need to detail how to create a root span.

@marcalff marcalff mentioned this pull request Dec 4, 2023
@lalitb lalitb changed the title [For discussion] Create root span with active span Create root span with active span Dec 5, 2023
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.

LGTM, just one suggestion.

Nice trick to have the fix in ABIv1.

sdk/test/trace/tracer_test.cc Outdated Show resolved Hide resolved
@marcalff marcalff changed the title Create root span with active span [API] Create root span with active span Dec 5, 2023
@marcalff marcalff merged commit 48e633e into open-telemetry:main Dec 5, 2023
45 checks passed
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.

Ability to create a root span (span with no parent) when another span is active.
2 participants