open-telemetry / opentelemetry-collector-contrib

Contrib repository for the OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
2.73k stars 2.16k forks source link

Filter all the data sent by an application #33802

Open MaGaudin opened 1 week ago

MaGaudin commented 1 week ago

Component(s)

No response

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

We are always in trouble when we need to filter or drop data coming from an application. We have implemented an OTEL Collector in gateway mode, specifically with 10 apps sending data. We want to completely exclude one application, but this only works well for traces and logs. Using the filter processor for metrics is not feasible as it also drops metrics that are common with other applications.

Describe the solution you'd like

A way to exclude all the data coming from a particular application. Maybe an option on the Otel Receiver could be useful.

Describe alternatives you've considered

Tell to the dev team to stop sending data to the collector. You can understand that it's not feasible if we need to drop data only for test purposes.

Additional context

No response

crobert-1 commented 1 week ago

We want to completely exclude one application, but this only works well for traces and logs. Using the filter processor for metrics is not feasible as it also drops metrics that are common with other applications.

Can you share what you want to filter by, in terms of resource attribute or attribute, or some other part of the metric? This would be helpful in better understanding potential solutions here.

MaGaudin commented 2 days ago

Hi @crobert-1,

Thanks for your reply. I just wanna filter everything coming from an application.

Let's say we have App A and App B sending data to the Otel Collector.

If, for testing purposes, I do not want to ingest data from App B, just to understand what's going on with App A, I need to ask developers to stop sending data to the collector.

So, here is my question. Is there a way to filter (or refuse) everything coming from an application?

Maybe, there is a way to do that but we were not able to find and use it.

crobert-1 commented 2 days ago

Can you share the configuration you're using that isn't working as expected? It would also be helpful to share some example metric data that isn't behaving in the way you'd expect.

MaGaudin commented 1 day ago

We tried something like this:

filter/exclude:
  metrics:
    exclude:
      match_type: expr/strict
      expressions:
        - Label("job") == "AAAA"

I think that, for the way the filter processor was designed, this worked well. I mean... this config dropped all the metrics with that label. But, since we are filtering metrics and not active series, the config dropped the metrics also for other applications, being some of them in common.

From here, we would like to have something more general as explained above.