Skip to content

Commit dd600c1

Browse files
authored
[processor/tailsampling] Allow invert matches in composite policy to continue processing (#36673)
1 parent ed96f74 commit dd600c1

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
2+
change_type: breaking
3+
4+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
5+
component: processor/tailsampling
6+
7+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
8+
note: "Reverts #33671, allowing for composite policies to specify inverted clauses in conjunction with other policies. This is a change bringing the previous state into place, breaking users who rely on what was introduced as part of #33671."
9+
10+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
11+
issues: [34085]
12+

processor/tailsamplingprocessor/internal/sampling/and.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ func NewAnd(
2929
// Evaluate looks at the trace data and returns a corresponding SamplingDecision.
3030
func (c *And) Evaluate(ctx context.Context, traceID pcommon.TraceID, trace *TraceData) (Decision, error) {
3131
// The policy iterates over all sub-policies and returns Sampled if all sub-policies returned a Sampled Decision.
32-
// If any subpolicy returns NotSampled or InvertNotSampled it returns that
32+
// If any subpolicy returns NotSampled or InvertNotSampled, it returns NotSampled Decision.
3333
for _, sub := range c.subpolicies {
3434
decision, err := sub.Evaluate(ctx, traceID, trace)
3535
if err != nil {
3636
return Unspecified, err
3737
}
3838
if decision == NotSampled || decision == InvertNotSampled {
39-
return decision, nil
39+
return NotSampled, nil
4040
}
4141
}
4242
return Sampled, nil

processor/tailsamplingprocessor/internal/sampling/and_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,5 +110,5 @@ func TestAndEvaluatorStringInvertNotSampled(t *testing.T) {
110110
}
111111
decision, err := and.Evaluate(context.Background(), traceID, trace)
112112
require.NoError(t, err, "Failed to evaluate and policy: %v", err)
113-
assert.Equal(t, InvertNotSampled, decision)
113+
assert.Equal(t, NotSampled, decision)
114114
}

0 commit comments

Comments
 (0)