open-telemetry / opentelemetry-python-contrib

OpenTelemetry instrumentation for Python modules
https://opentelemetry.io
Apache License 2.0
741 stars 615 forks source link

Add an exclude list in the OpenTelemetryMiddleware #2369

Open axel584 opened 8 months ago

axel584 commented 8 months ago

Describe the solution you'd like I use bottle as web framework and the WSGI Instrumentation to trace my app. It's work fine, but I can't config an exclude list (as for flask or fastAPI).

Describe alternatives you've considered I thought about making a version of the instrumentation specifically for Bottle, but I think all WSGI frameworks might need to pass an exclusion list to the constructor.I

Thank you

andy-edvalson commented 7 months ago

I believe this might already be present! I needed the same thing for our Quart App and found it already there. I just submitted a PR to add this functionality to the docs

https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2407

andy-edvalson commented 7 months ago

Oops, I misread that you are using WSGI and not ASGI. ASGI has the param in the constructor, but WSGI does not. It looks easy enough to lift from asgi though!