prometheus / prometheus/client_python
Collect metrics on scrape instead of timer
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.4k
- Forks
- 876
- Avg merge
- 8d 4h
- Merged PRs (30d)
- 1
Description
The prometheus docs on exporters say:
Metrics should only be pulled from the application when Prometheus scrapes them, exporters should not perform scrapes based on their own timers. That is, all scrapes should be synchronous.
The very first example provided by this repository goes against those docs by just spamming the same function on a timer.
Can anyone provide a basic example that shows how to start a metrics collection only when prometheus connects to the exporter, as it's actually supposed to be done? Because christ, it's faster to just set up a flask server with a custom /metrics endpoint than actually figure out how to do so using this framework.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Prometheus exporter scheduling documentation and the repository's first example, which the issue identifies as timer-based. Add a basic example showing collection starts synchronously when Prometheus scrapes the exporter; done means the example no longer performs collection on its own timer.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation, observability-sre
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100