feat: [SVLS-8390] drop sampled-out traces from backend when compute_trace_stats_on_extension is enabled#1060
Open
feat: [SVLS-8390] drop sampled-out traces from backend when compute_trace_stats_on_extension is enabled#1060
Conversation
…n_extension is enabled When `compute_trace_stats_on_extension` is true, traces with a sampling priority of <= 0 (`AUTO_DROP` or `USER_DROP`) are now dropped and not flushed to the Datadog backend. Stats computation is unaffected: dropped traces are still processed and their stats are sent to the concentrator. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…_processed_traces Instead of partitioning raw traces and calling process_traces twice, the sampling-out filtering now happens inside ServerlessTraceProcessor::process_traces. The payloads_for_stats clone (for stats) is taken before the filter, so stats always include sampled-out traces. The backend payload has sampled-out chunks removed in-place. send_processed_traces is simplified to a single process_traces call, with stats computed before the backend send. The OwnedTracerHeaderTags upfront conversion is also removed since only one process_traces call is needed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When compute_trace_stats_on_extension is true and all trace chunks are filtered out due to sampling priority, process_traces now returns Option::None for the SendDataBuilderInfo instead of constructing an empty payload. Callers skip the backend send when None is received. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
lym953
commented
Mar 5, 2026
|
|
||
| /// Sentinel value used by `collect_pb_trace_chunks` when `_sampling_priority_v1` is absent. | ||
| const CHUNK_PRIORITY_NOT_SET: i32 = i8::MIN as i32; | ||
|
|
Contributor
Author
There was a problem hiding this comment.
For the meaning of sampling priority values, see https://github.com/DataDog/datadog-agent/blob/87b54753cff79a75fa9c68390d838735b46023b0/pkg/trace/sampler/sampler.go#L50-L63
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
compute_trace_stats_on_extensionistrue, traces with sampling priority<= 0(AUTO_DROP/USER_DROP) are now dropped and not flushed to the Datadog backend.compute_trace_stats_on_extensionisfalse(the current default), traces are not dropped because all traces need to be sent to Datadog so trace stats can be computed.process_tracesand their stats are forwarded to the stats concentrator.Test plan
Manual test
Steps
Result
Logs show that
aws.lambdaspan for some of the 6 invocations were not flushed to Datadog.🤖 Partially generated with Claude Code