-
Notifications
You must be signed in to change notification settings - Fork 795
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
fix: respect sampled flag in Span Processors, fix associated tests #2396
fix: respect sampled flag in Span Processors, fix associated tests #2396
Conversation
|
packages/opentelemetry-tracing/test/common/export/SimpleSpanProcessor.test.ts
Outdated
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## main #2396 +/- ##
==========================================
- Coverage 92.80% 92.79% -0.02%
==========================================
Files 145 145
Lines 5226 5230 +4
Branches 1071 1073 +2
==========================================
+ Hits 4850 4853 +3
- Misses 376 377 +1
|
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.
lgtm
5481af4
to
f9db7e5
Compare
packages/opentelemetry-tracing/src/export/BatchSpanProcessorBase.ts
Outdated
Show resolved
Hide resolved
f9db7e5
to
9d66288
Compare
packages/opentelemetry-tracing/test/common/export/BatchSpanProcessorBase.test.ts
Outdated
Show resolved
Hide resolved
@quickgiant Please avoid forced pushes as this makes reviewing of changes harder. It's fine to add a lot commits and merge main as needed. During integration to main all commits on your branch will be squashed into a single one. |
Which problem is this PR solving?
Fixes #2394
Short description of the changes
Span Processor classes were missing a check on trace flags to determine whether spans are sampled and should be exported, as per the spec here: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk.md#sampling. These classes originally performed this check and in the case of
SimpleSpanProcessor
, there is actually a unit test for the behavior that was incorrectly passing due to an issue regarding a shared exporter instance across tests. Since the shared exporter was shut down in the first test, the unsampled span was being dropped, causing the test to pass for the wrong reason.This change restores the trace flags checks, fixes the
SimpleSpanProcessor
test, and adds a new test forBatchSpanProcessor
. No change is needed forMultiSpanProcessor
because the individual span processors ought to do the checks themselves.