My application processes messages from rabbit queue. Lots of the messages are inappropriate for processing (not ideal, but for a valid reason), so the application is just rejecting them upon reading without re-queuing them.
As the messaging library (aio_pika) is otel instrumented, it generates loads of unnecessary spans that are exported. What is the best way to exclude these spans from being exported?
I haven’t found a way to signal this, or mark the current span as “non-recording”.
I’m thinking about:
a) writing a SpanProcessor wrapper that would drop custom marked spans
b) writing custom / patching aio_pika instrumentation to support this filtering
Yet, I hope there is a better way.
I do not want to export the spans and filter them out on the Otel Collector level.
Besides the above mentioned scenario, I have other use-cases, when I’d like to exclude (declaratively or programatically) some spans from flooding the exporter/collector.
Thank you for any ideas.