-
Notifications
You must be signed in to change notification settings - Fork 807
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
Span Processors do not respect sampled flag when exporting #2394
Comments
The sampling decision is checked in Tracer and it creates a According to spec that seems to be ok. Spec does not require that recorded spans are not exported (should not instead Which sampler do you use and which return value is used by your sampler? Is it |
In the "Sampling" section of the specification, the flag you're referring to is called |
@quickgiant Yes I know the three states. But looking into all samples in this repo they either return |
Yes, the bug was encountered when using a custom sampler that uses |
What version of OpenTelemetry are you using?
@opentelemetry/api@1.0.2
@opentelemetry/tracing@0.24.0
@opentelemetry/exporter-jaeger@0.24.0
What version of Node are you using?
14.17.3
What did you do?
BasicTracerProvider
RECORD_ONLY
sampling decisionBatchSpanProcessor
orSimpleSpanProcessor
What did you expect to see?
Expected that only sampled spans would be exported, per the spec, and as described by doc comments on
SimpleSpanProcessor
and theSpanExporter
interface.What did you see instead?
All spans are exported.
Additional context
It seems that the sampled flag was originally being respected by Span Processors, but the logic was removed in this PR: #798. The rationale at the time was that the check was redundant, since Tracer was also checking the sampled flag and preventing unsampled spans from being recorded.
In a later PR #1058, the Tracer check was changed to differentiate between not recorded and not sampled, which resulted in no check being made for the sampled flag.
Looks like the original check in Span Processors just needs to be re-added, which I would be willing to take on and make a PR for. There should probably also be a test for this to ensure that the spec is met.
The text was updated successfully, but these errors were encountered: