Skip to content

Commit

Permalink
Revert "[processor/tailsampling] fix InvertNotSampled decision prec…
Browse files Browse the repository at this point in the history
…edence when inside and sub policy (open-telemetry#33671)"

This reverts commit e2fda02.
  • Loading branch information
Hanna Yang committed Jul 16, 2024
1 parent d6be16b commit fe7acca
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions processor/tailsamplingprocessor/internal/sampling/and.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ func NewAnd(
// Evaluate looks at the trace data and returns a corresponding SamplingDecision.
func (c *And) Evaluate(ctx context.Context, traceID pcommon.TraceID, trace *TraceData) (Decision, error) {
// The policy iterates over all sub-policies and returns Sampled if all sub-policies returned a Sampled Decision.
// If any subpolicy returns NotSampled or InvertNotSampled it returns that
// If any subpolicy returns NotSampled, it returns NotSampled Decision.
for _, sub := range c.subpolicies {
decision, err := sub.Evaluate(ctx, traceID, trace)
if err != nil {
return Unspecified, err
}
if decision == NotSampled || decision == InvertNotSampled {
return decision, nil
return NotSampled, nil
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,6 @@ func TestAndEvaluatorStringInvertNotSampled(t *testing.T) {
}
decision, err := and.Evaluate(context.Background(), traceID, trace)
require.NoError(t, err, "Failed to evaluate and policy: %v", err)
assert.Equal(t, decision, InvertNotSampled)
assert.Equal(t, decision, NotSampled)

}

0 comments on commit fe7acca

Please sign in to comment.