open-telemetry / open-telemetry/opentelemetry-python

Prometheus exporter does not work with multiprocessing

Open Beginner friendly
#3,747 3 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug doc help wanted
Dominant language
Python
Stars
2.6k
Forks
1k
Avg merge
4d 15h
Merged PRs (30d)
19

Description

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

  • Raise metrics in multiprocessing mode when having the Prometheus exporter enabled
  • Not all metrics are exposed on Prometheus endpoint

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the Prometheus exporter documentation under exporter/opentelemetry-exporter-prometheus and review the linked prometheus_client multiprocess documentation. Document that multiprocess mode does not work with custom collectors and can cause metrics to be missing from the endpoint. Done means the limitation is clearly explained for users configuring multiprocessing.

Written by the indexing model from the issue text.

Assessment

Tech stack
prometheus, python
Domain
documentation, observability
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.