Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter out/reject traces with a single span with "and logic" based on an attribute #29093

Closed
droonee opened this issue Nov 9, 2023 · 11 comments
Labels
processor/tailsampling Tail sampling processor question Further information is requested Stale waiting for author

Comments

@droonee
Copy link

droonee commented Nov 9, 2023

Component(s)

processor/filter

Is your feature request related to a problem? Please describe.

I am ingesting traces into a backend and processing trace data to control cost.

I have a few examples of traces that only contain a single span. Span A will usually be nested in a full trace but sometimes will populate a unique trace with one span, i.e. Trace with only Span A. I want to eliminate the occurrence of Span A when it is the only span in a trace but don't want to eliminate other traces with a single span - in this case, I will need to also be specific about the span based on an attribute, i.e. span name.

Describe the solution you'd like

I'd like to reject traces with a single span that also contain a specific span name (or customer attibrute).

Describe alternatives you've considered

No response

Additional context

No response

@droonee droonee added enhancement New feature or request needs triage New item requiring triage labels Nov 9, 2023
@github-actions github-actions bot added the processor/filter Filter processor label Nov 9, 2023
Copy link
Contributor

github-actions bot commented Nov 9, 2023

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

Copy link
Contributor

Pinging code owners for pkg/ottl: @TylerHelmuth @kentquirk @bogdandrutu @evan-bradley. See Adding Labels via Comments if you do not have permissions to add labels yourself.

@crobert-1
Copy link
Member

Hello @droonee, I believe this is actually a pretty involved request. The filter processor filters traces at the span level, with no context of the trace as a whole. This means we'd need to re-architect the scope of the filtering logic in the processor itself and make sure it's backwards compatible to existing filters.

Also, the filtering logic is done by OTTL at the span context level. The span context in OTTL only has span-level information available, not trace. So this may require a whole new trace context to be added to OTTL.

For context, I'll just share that there's another open request (#28875) to compare values across spans within the same trace, so multiple people are looking for functionality similar to this.

I'll defer to code owners for more information though. I'm not super familiar with the internal workings of these components so I may have even missed something obvious. I'm also aware this may get into much bigger architectural discussions that others would be much better suited for.

@TylerHelmuth
Copy link
Member

@droonee, @crobert-1 is correct that the filterprocessor doesn't know about the state of a trace as a whole. I do believe you could do this with the tailsamplingprocessor.

IF the name of the span is consistent, you could look for the parent span id to be nil to identify it as a root span. If your situation means that the solo span scenario is the root span, you could do this in the filterprocessor.

parent_span_id == nil and name == "something"

@TylerHelmuth TylerHelmuth added processor/tailsampling Tail sampling processor and removed needs triage New item requiring triage pkg/ottl labels Nov 13, 2023
Copy link
Contributor

Pinging code owners for processor/tailsampling: @jpkrohling. See Adding Labels via Comments if you do not have permissions to add labels yourself.

@crobert-1 crobert-1 added question Further information is requested and removed enhancement New feature or request processor/filter Filter processor labels Nov 15, 2023
@jiekun
Copy link
Member

jiekun commented Nov 22, 2023

Hi. I feel like span_count tail sampling policy could help you.

It's easy to impl the following logic with tail sampling processor: https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/tailsamplingprocessor

    if span_name == "xxx" and span_count_in_a_trace == 1 {
            drop_the_trace
    }

I cannot write the whole config on phone but I believe that's not difficult for ya. Feel free to comment if you need further help.

@jpkrohling
Copy link
Member

Agree, a combination of span_count and string_attribute should accomplish what's been requested.

Copy link
Contributor

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@github-actions github-actions bot added the Stale label Jan 29, 2024
@crobert-1
Copy link
Member

@droonee Were you able to get this working? Is there anything left here or can we close the issue?

Copy link
Contributor

github-actions bot commented Apr 1, 2024

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@github-actions github-actions bot added the Stale label Apr 1, 2024
@jpkrohling
Copy link
Member

I'm closing this, feel free to reopen if it's still a problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
processor/tailsampling Tail sampling processor question Further information is requested Stale waiting for author
Projects
None yet
Development

No branches or pull requests

5 participants