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

Support determining parent span from Context while creating new Span #969

Merged
merged 8 commits into from
Sep 8, 2021

Conversation

lalitb
Copy link
Member

@lalitb lalitb commented Sep 2, 2021

Fixes #955

Changes

This adds support for passing Context wrapping parent Span object while creating new Span.

  • In order to not avoid breaking the existing customers code, the legacy api supporting passing SpanContext object is also kept in place. Also to avoid storing two different variables for Context and SpanContext inside StartSpanOptions struct, variant object is introduced within this struct.
  • Slight restructuring in header files was required to avoid cyclic dependency in header files ( i.e span.h requiring context/context.h and context/context.h requiring span.h through context/context_value.h) : this required adding span_startoptions.h and span_metadata.h.

cc @jsuereth

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 September 2, 2021 23:47
@codecov
Copy link

codecov bot commented Sep 2, 2021

Codecov Report

Merging #969 (1bf59ef) into main (703576c) will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #969      +/-   ##
==========================================
+ Coverage   95.36%   95.38%   +0.03%     
==========================================
  Files         161      161              
  Lines        6780     6817      +37     
==========================================
+ Hits         6465     6502      +37     
  Misses        315      315              
Impacted Files Coverage Δ
api/include/opentelemetry/trace/span.h 100.00% <ø> (ø)
api/include/opentelemetry/trace/tracer.h 100.00% <ø> (ø)
sdk/src/trace/tracer.cc 90.25% <100.00%> (+2.75%) ⬆️
sdk/test/trace/tracer_test.cc 99.52% <100.00%> (+0.04%) ⬆️

@lalitb lalitb changed the title suport parent span from context Support determining parent span from Context while creating new Span Sep 3, 2021
@lalitb
Copy link
Member Author

lalitb commented Sep 3, 2021

build failed due to merge conflict with #966 , have resolved them now.

@ThomsonTan ThomsonTan merged commit f7af82e into open-telemetry:main Sep 8, 2021
@lalitb lalitb mentioned this pull request Sep 17, 2021
3 tasks
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.

Span Parent should be determined from Context (and take this as a parameter.
3 participants