open-telemetry / opentelemetry-python-contrib

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

Add exemplar support to all WSGI based instrumentations #2158

Open AlexisBRENON opened 5 months ago

AlexisBRENON commented 5 months ago

Describe the solution you'd like I would like that recorded spans from the WSGI instrumentation (in particular the Flask one) also provide exemplars. Currently there is no link between the spans and the related metrics.

Describe alternatives you've considered Up to now, I used custom histogram and custom spans (in my own request handler). But this is redundant with the more integrated instrumentation setup.

Additional context According to the OTel documentation, any metric published inside an active span get linked as an exemplar. However, the latency of the handler seems to be reported after the handler-span has ended. So no link is recorded between the span and the metric, while both are clearly related.

aabmass commented 5 months ago

Exemplars are not implemented in the Python SDK yet https://github.com/open-telemetry/opentelemetry-python/issues/2407

So the PR you sent won't have any effect right now, unfortunately.