[processor/spanpruning] Add span pruning conditions#49026
Open
portertech wants to merge 16 commits into
Open
Conversation
Signed-off-by: Sean Porter <portertech@gmail.com>
The unparam linter flagged createTestTraceWithLeafSpans (spanName always "SELECT") and createTestTraceWithResourceAttr (numLeafSpans always 3). Drop the constant parameters and inline the values to satisfy lint.
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.
Add OTTL condition filtering to span pruning processor
Description
This PR adds optional OTTL
conditionsfiltering to the span pruning processor, letting users restrict pruning to only the traces they care about instead of pruning everything. It builds on the existing core pruning, parent recursion, histogram buckets, attribute-loss analysis, and outlier analysis.Changes
New feature: Selective pruning with OTTL conditions
By default the processor prunes every trace. This feature lets you scope pruning to a subset of traces using OTTL span-context expressions, so you can target noisy services while leaving the rest of your trace data untouched.
conditionsis empty or unset, all traces are pruned exactly as beforeottlspanusing only publicpkg/ottlAPIs (StandardConvertersplusIsRootSpan), avoiding the internalfilterottlpackageVisibility is provided through:
otelcol_processor_spanpruning_traces_skipped- total traces skipped because no span matched the configured conditionsConfiguration options:
When
conditionsis empty, behavior is unchanged.Testing
IsRootSpanfunction, andnewBoolExprForSpancondition compilation)conditions(blank-entry rejection and nil-slice defaults)traces_skippedmetric is recorded for skipped tracesgo test ./...,go vet ./...,gofmt -l ., andgolangci-lint runare all passing/cleanDocumentation
Updated README with an OTTL condition filtering section (behavior table, syntax, common examples, and use cases), the new config field, and the
traces_skippedmetric; added the counter tometadata.yamland the generateddocumentation.md. Added thepkg/ottldependency and crosslink replaces togo.mod/go.sum.