Skip to content

[processor/tailsampling] numeric attribute invert match evaluation not prioritized #34296

Closed as not planned
@hyang023

Description

@hyang023

Component(s)

processor/tailsampling

What happened?

Description

as described in the tail sampling processor readme (https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/tailsamplingprocessor),

When there's an "inverted not sample" decision, the trace is not sampled;

this functionality does not work for numeric attribute policies because its Evaluate function only returns Sampled or NotSampled values not InvertNotSampled or InvertSampled even if invertMatch is true

The Evaluate function in https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/processor/tailsamplingprocessor/internal/sampling/numeric_tag_filter.go#L37 needs to be updated so that it can return InvertNotSampled or InvertSampled when appropriate

This would likely require the addition of an invertHasSpanWithCondition in https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/processor/tailsamplingprocessor/internal/sampling/util.go and then calling it from https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/processor/tailsamplingprocessor/internal/sampling/numeric_tag_filter.go if invertMatch is true

Steps to Reproduce

  • use invert_match in numeric_attribute sampling policy
  • have other policy where spans that match overlap with the number_attribute invert_match

Expected Result

  • any trace with spans that invert_match the numeric_attribute should not be sampled

Actual Result

  • some traces with spans that invert_match the numeric_attribute will still be sampled because they match some other policy

Collector version

v0.105.0 but previous versions would also be affected

Environment information

Environment

this is not environment specific

OpenTelemetry Collector configuration

No response

Log output

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions