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

[ETW Exporter] - Add Trace flags in SpanContext #1618

Merged
merged 8 commits into from
Sep 19, 2022

Conversation

lalitb
Copy link
Member

@lalitb lalitb commented Sep 15, 2022

Changes

ETW exporter doesn't preserve trace flags while creating span. The trace flags contain the IsSampled flag based on the sampling decision. This result in incorrect sampling logic execution.

Also added code to copy the tracer_id from parent span to child span.

The code is taken from the sdk implementation, and a unit test is added to validate it.

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 15, 2022 20:56
@lalitb lalitb changed the title [ETW Exporter] - Add sampling flags. [ETW Exporter] - Add sampling flags in SpanContext Sep 15, 2022
@codecov
Copy link

codecov bot commented Sep 15, 2022

Codecov Report

Merging #1618 (5fb17a0) into main (ed9f583) will decrease coverage by 0.07%.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1618      +/-   ##
==========================================
- Coverage   85.28%   85.22%   -0.06%     
==========================================
  Files         156      156              
  Lines        4978     4978              
==========================================
- Hits         4245     4242       -3     
- Misses        733      736       +3     
Impacted Files Coverage Δ
...include/opentelemetry/sdk/common/circular_buffer.h 98.00% <0.00%> (-2.00%) ⬇️
ext/src/http/client/curl/http_client_curl.cc 80.31% <0.00%> (-1.13%) ⬇️
sdk/src/trace/batch_span_processor.cc 91.41% <0.00%> (+0.79%) ⬆️

@lalitb lalitb changed the title [ETW Exporter] - Add sampling flags in SpanContext [ETW Exporter] - Add Trace flags in SpanContext Sep 16, 2022
@lalitb
Copy link
Member Author

lalitb commented Sep 16, 2022

@ThomsonTan Can you please help review it? Thanks.

auto traceId = parentContext.IsValid() ? parentContext.trace_id() : traceId_;

// Sampling based on attributes is not supported for now, so passing empty below.
std::map<std::string, int> empty_attributes = {{}};
Copy link
Member

Choose a reason for hiding this comment

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

cosmetic: It seems this file has mixed camel case and snake case.
It would be good if you could unify at least the parts you are changing.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks good comment. I gave it a thought, and using snake-case now, to make it consistent with the existing ETW exporter naming style. We will eventually move this component out of the core library.

@ThomsonTan ThomsonTan merged commit 2142d00 into open-telemetry:main Sep 19, 2022
yxue pushed a commit to yxue/opentelemetry-cpp that referenced this pull request Dec 5, 2022
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.

3 participants