Questions about new tailsampling span ingest strategy #48078
Replies: 2 comments 3 replies
|
Looking at the current behavior a bit further, I was focused more on the case of separate batches of spans for the same trace, and the batch that contains the opentelemetry-collector-contrib/processor/tailsamplingprocessor/processor.go Lines 848 to 858 in e064b15 I think I'm more confident in this simpler case being a bug? Happy to file an issue and move any discussion to the issue if that's more the preferred workflow. Thanks again. |
|
@john-morales Your reading was correct — this was a genuine bug, and it has since been fixed. @csmarchbanks (who you CC'd) addressed exactly this class of problem in #47476 — "[processor/tailsampling] Fix drop, latency, and span count policies in span ingest mode" — merged May 5 and shipped in v0.126.0. Two mechanisms from that PR resolve your example: 1. Drop policies are always evaluated first, regardless of their position in 2. A pending drop policy blocks any eager // A drop policy returning NotSampled means it didn't match these spans but
// could still match future spans for this trace, so we must defer a Sampled
// decision to avoid forwarding spans that should ultimately be dropped.The loop then refuses to return The same PR also closed the related "a positive decision could later flip" cases you'd expect to matter: latency policies with an I believe that fully covers what you raised, so this can probably be closed as resolved (for >= v0.126.0). Nice catch on the original report. |
Uh oh!
There was an error while loading. Please reload this page.
Hi folks!
I've been following along on recent changes to the tailsampling processor (and was preparing to offer a couple low-priority bugfixes that I've come across).
However I recently came upon the work by @carsonip on storage support via pebble extension, as well as the new "span ingest" strategy mode of evaluating a batch of spans on the ingestion path for any terminal decisions that can be made eagerly, rather than strictly waiting for the full
decision_waittime to make a decision on whole traces.Something I was looking for clarification on is whether the "span ingest" behavior is actually backward compatible with the existing evaluation order precedence?
https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/processor/tailsamplingprocessor/README.md#policy-decision-flow
My read of the code is that a decision of
Sampledfrom a partial trace batch results in an eager decision to sample and forward those traces:opentelemetry-collector-contrib/processor/tailsamplingprocessor/processor.go
Lines 948 to 961 in 171d78e
Now suppose the following simple tailsampling policy that aims for "sample all traces from service A, except if it's the test environment".
I believe the current code could (incorrectly) cause a partial trace from ServiceA to still be Sampled and forwarded on, because it might take another later batch of spans to observe the "test" environment attribute that would cause the whole trace to be dropped?
Said differently, I think my question is whether perhaps "Sampled" cannot safely be used as a terminal decision. (I also see that the current implementation attempts to identify "stateful" policy
Evaluator's, which are checked at startup to ensure the "span ingest" strategy cannot be used if a policy definition contains a statefulEvaluator. But note this example is simply usingstring_attribute, which is not stateful.)I know I've spent quite some time squinting at the evaluation order rules, so apologies if I'm still off my reasoning here. But if the current code's behavior is expected, might I suggest this be more prominently documented.
Thanks for your time. (CC @csmarchbanks since I saw on another PR that you had some thoughts/experience here.)
All reactions