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

make span context management api public #966

Closed
wants to merge 6 commits into from

Conversation

lalitb
Copy link
Member

@lalitb lalitb commented Sep 1, 2021

Fixes #950

Changes

Move span-context helper methods from trace::propagation to trace namespace. They are now treated as being in public api namespace. It's not possible to move them to Span API ( i.e, making them static within api::Span class ) as the complete implementation of DefaultSpan is not visible/available in that class.

This is how header structure looks like:

context/context.h - contains implementation for context data-structure logic
trace/tracer.h - span context management ( implicit )
trace/context.h - span context management ( explicit )

The implicit context management are still static methods in trace::tracer class to ensure not to introduce a breaking change, and at the same time remain specs compliant.

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 1, 2021 22:19
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Sep 1, 2021

CLA Missing ID

@codecov
Copy link

codecov bot commented Sep 1, 2021

Codecov Report

Merging #966 (6062988) into main (7b1842b) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #966   +/-   ##
=======================================
  Coverage   95.36%   95.36%           
=======================================
  Files         161      161           
  Lines        6780     6780           
=======================================
  Hits         6465     6465           
  Misses        315      315           
Impacted Files Coverage Δ
api/include/opentelemetry/trace/context.h 100.00% <100.00%> (ø)
...de/opentelemetry/trace/propagation/b3_propagator.h 93.45% <100.00%> (ø)
...entelemetry/trace/propagation/http_trace_context.h 93.66% <100.00%> (ø)
...i/include/opentelemetry/trace/propagation/jaeger.h 97.68% <100.00%> (ø)
...pi/test/trace/propagation/http_text_format_test.cc 100.00% <100.00%> (ø)
.../test/trace/propagation/jaeger_propagation_test.cc 98.15% <100.00%> (ø)

@@ -112,7 +112,7 @@ void BM_SpanCreationWitContextPropagation(benchmark::State &state)
auto outer_span_context = SpanContext(trace_id, span_id, trace_api::TraceFlags(), false);
auto outer_span =
nostd::shared_ptr<trace_api::Span>(new trace_api::DefaultSpan(outer_span_context));
trace_api::propagation::SetSpan(current_ctx, outer_span);
opentelemetry::trace::SetSpan(current_ctx, outer_span);
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably just use trace_api as it is already used a lot?

@@ -6,7 +6,7 @@
#include "tracer_common.h"
#include "opentelemetry/trace/span_context_kv_iterable_view.h"
#include "opentelemetry/trace/semantic_conventions.h"

#include "opentelemetry/trace/context.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix order of header files?

@lalitb
Copy link
Member Author

lalitb commented Sep 2, 2021

@ThomsonTan - Thanks for reviewing the PR. I have fixed the comments. But had to raise new PR with all these changes( #966 ) as this PR has easycla issue with few commits. Please review that, it already has your suggested changes.

@lalitb
Copy link
Member Author

lalitb commented Sep 2, 2021

closing this PR

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.

Helper methods for accessing Span directly from Context in Span API
2 participants