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

Add Jaeger propagator #599

Merged
merged 17 commits into from
Mar 12, 2021
Merged

Add Jaeger propagator #599

merged 17 commits into from
Mar 12, 2021

Conversation

seemk
Copy link
Contributor

@seemk seemk commented Mar 5, 2021

Fixes #542

Changes

Adds Jaeger trace extraction and injection as specified here.

Baggage is not part of the PR as it's not supported by the otel-cpp API yet.

Miscellaneous:

  • Removed GetCurrentSpan duplication from each propagator. Moved it to context's member function.
  • Added hex (zero left-padded parse) and string helper (split) functions. These can be used in the b3 and http propagators to simplify code and remove duplication. Not part of this PR though, I will do a follow up if this one gets merged.

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

@seemk seemk requested a review from a team March 5, 2021 20:19
@codecov
Copy link

codecov bot commented Mar 5, 2021

Codecov Report

Merging #599 (5e46c5f) into main (b80cc91) will increase coverage by 0.04%.
The diff coverage is 97.70%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #599      +/-   ##
==========================================
+ Coverage   94.40%   94.45%   +0.04%     
==========================================
  Files         191      197       +6     
  Lines        9066     9183     +117     
==========================================
+ Hits         8559     8674     +115     
- Misses        507      509       +2     
Impacted Files Coverage Δ
...de/opentelemetry/trace/propagation/detail/string.h 93.33% <93.33%> (ø)
...i/include/opentelemetry/trace/propagation/jaeger.h 97.56% <97.56%> (ø)
.../test/trace/propagation/jaeger_propagation_test.cc 97.82% <97.82%> (ø)
api/include/opentelemetry/context/context.h 100.00% <100.00%> (ø)
...de/opentelemetry/trace/propagation/b3_propagator.h 97.72% <100.00%> (-0.15%) ⬇️
...e/opentelemetry/trace/propagation/detail/context.h 100.00% <100.00%> (ø)
...clude/opentelemetry/trace/propagation/detail/hex.h 100.00% <100.00%> (ø)
...entelemetry/trace/propagation/http_trace_context.h 85.85% <100.00%> (-0.81%) ⬇️
api/test/trace/propagation/util.h 100.00% <100.00%> (ø)
... and 7 more

Copy link
Member

@lalitb lalitb left a comment

Choose a reason for hiding this comment

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

LGTM in general with few minor comments. Thanks for restructuring code to eliminate code duplication as part of this.

@@ -93,6 +93,17 @@ class Context

bool operator==(const Context &other) const noexcept { return (head_ == other.head_); }

trace::SpanContext GetCurrentSpan() const
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Ideally Context class should be agnostic of what is stored inside. Do you think we can instead keep it under propagation::detail namespace ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved it to propagation::detail, but I think the context API is somewhat unfriendly to users, especially if accessing and setting spans is probably the most common use case.

api/include/opentelemetry/trace/propagation/jaeger.h Outdated Show resolved Hide resolved
@lalitb lalitb requested a review from a team March 11, 2021 19:45
api/include/opentelemetry/trace/propagation/jaeger.h Outdated Show resolved Hide resolved
}

nostd::string_view trace_id_hex = trace_fields[0];
nostd::string_view span_id_hex = trace_fields[1];
Copy link
Contributor

Choose a reason for hiding this comment

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

Is trace_fields[2] not used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, it's the deprecated parent span ID (https://www.jaegertracing.io/docs/1.22/client-libraries/#value)

@lalitb lalitb merged commit 1e5751e into open-telemetry:main Mar 12, 2021
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.

Implement Jaeger Propagator
3 participants