open-telemetry / opentelemetry-python

OpenTelemetry Python API and SDK
https://opentelemetry.io
Apache License 2.0
1.81k stars 633 forks source link

Prometheus exporter does not work with multiprocessing #3747

Open bastbu opened 8 months ago

bastbu commented 8 months ago

Describe your environment

When instrumenting metrics using OpenTelemetry Python 0.44b0 and exporting them using opentelemetry-exporter-prometheus when using multiprocessing, not all metrics are exposed on the metrics endpoint.

I assume that this comes from the underlying limitation from prometheus_client, which states that multiprocess mode does not work with custom collectors. It could be worth mentioning this limitation in the Prometheus exporter docs.

Steps to reproduce

What is the expected behavior?

All raised metrics are exposed on the Prometheus endpoint.

What is the actual behavior?

Not all metrics are exposed on the Prometheus endpoint.

srikanthccv commented 8 months ago

Feel free to send a PR