Skip to content

Propagate trace and parent span ids#305

Merged
reyang merged 6 commits into
open-telemetry:masterfrom
nadiaciobanu:propagateids
Aug 28, 2020
Merged

Propagate trace and parent span ids#305
reyang merged 6 commits into
open-telemetry:masterfrom
nadiaciobanu:propagateids

Conversation

@nadiaciobanu
Copy link
Copy Markdown
Contributor

@nadiaciobanu nadiaciobanu commented Aug 28, 2020

Now that the Span class contains a SpanContext instance, we can propagate trace and parent span ids using SpanContext. When the tracer creates a new Span, get the SpanContext of the current span from the runtime context and pass it to the Span constructor. In the Span constructor, create a new SpanContext and use the parent span context to set the trace and parent span id.

I exported to GCP using the OTLP example (example/otlp) and verified that the trace and parent span ids propagate properly:
Screenshot 2020-08-28 at 11 14 00 AM

@nadiaciobanu nadiaciobanu requested a review from a team August 28, 2020 01:19
@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 28, 2020

Codecov Report

Merging #305 into master will increase coverage by 0.04%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #305      +/-   ##
==========================================
+ Coverage   94.55%   94.60%   +0.04%     
==========================================
  Files         146      146              
  Lines        6610     6633      +23     
==========================================
+ Hits         6250     6275      +25     
+ Misses        360      358       -2     
Impacted Files Coverage Δ
sdk/src/trace/span.cc 84.33% <100.00%> (+3.56%) ⬆️
sdk/src/trace/tracer.cc 73.52% <100.00%> (+4.56%) ⬆️
sdk/test/trace/tracer_test.cc 99.09% <100.00%> (+0.01%) ⬆️
...pi/include/opentelemetry/context/runtime_context.h 95.83% <0.00%> (-4.17%) ⬇️
api/include/opentelemetry/trace/span_context.h 100.00% <0.00%> (ø)
sdk/src/trace/span.h 100.00% <0.00%> (+100.00%) ⬆️

Comment thread sdk/src/trace/span.cc Outdated
Comment thread sdk/test/trace/tracer_test.cc
Copy link
Copy Markdown

@IlyaKobelevskiy IlyaKobelevskiy left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Member

@reyang reyang left a comment

Choose a reason for hiding this comment

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

LGTM.

@reyang reyang added the pr:please-merge This PR is ready to be merged by a Maintainer (rebased, CI passed, has enough valid approvals, etc.) label Aug 28, 2020
@nadiaciobanu
Copy link
Copy Markdown
Contributor Author

@reyang Ready to merge :)

@reyang reyang merged commit c36024d into open-telemetry:master Aug 28, 2020
GerHobbelt pushed a commit to GerHobbelt/opentelemetry-cpp that referenced this pull request Jun 17, 2025
[BUILD] Error out when building DLL without MSVC (open-telemetry#3438)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:please-merge This PR is ready to be merged by a Maintainer (rebased, CI passed, has enough valid approvals, etc.)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants