-
Notifications
You must be signed in to change notification settings - Fork 438
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] Tail based sampling support #1780
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1780 +/- ##
==========================================
- Coverage 85.73% 85.71% -0.01%
==========================================
Files 171 171
Lines 5240 5240
==========================================
- Hits 4492 4491 -1
- Misses 748 749 +1
|
…pp into etw-tail-sampling
{"enableRelatedActivityId", true}, | ||
{"enableAutoParent", true} | ||
}, | ||
std::move(always_on), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we start a span and test it is indeed dropped?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I was thinking to mock the actual ETW transport layer and do the test. In current design, this is not easy to do, perhaps can be taken separately if it is fine?
const opentelemetry::trace::Span &spanBase = | ||
reinterpret_cast<const opentelemetry::trace::Span &>(span); | ||
|
||
// Sample span based on the decision of tail based sampler | ||
auto sampling_result = const_cast<TailSampler *>(&tail_sampler)->ShouldSample(spanBase); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of making a virtual call to AlwaysOn sampler by default, perhaps check if there is a non-default sampler set, then make the virtual call? In this way, it doesn't introduce extra cost (except the null check) when tail based sampler is not used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good comment. Actually we do have virtual method calls for head-sampler, id-generator both in ETW exporter, and the otel-sdk. There is no reported performance reported with them. Seemingly modern compilers can optimize these repeated calls by caching the address, and avoid virtual indirection. Perhaps we can look back to this if there are reported overhead internally and/or by community.
Changes
Adding limited support for tail based sampling. Similar to head-sampling, TailSampler::ShouldSample() method needs to be overridden with sampling logic, which get's executed before the span is exporter.
The inherited TailSampler class object needs to be passed as argument to TracerProvider constructor. The default is
AlwaysOnTailSampler
Also, added use of macro
OPENTELEMETRY_NOT_USE_RTTI
to disable using RTTI in ETW exporter even if it is enabled in compiler. This is because the ETW exporter modified the attributes passed as argument if RTTI is enabled to reuse them for creating ETW event structure, which is sometime not desirable.For significant contributions please make sure you have completed the following items:
CHANGELOG.md
updated for non-trivial changes