prometheus / prometheus/client_python
Add usage example for Celery
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 4.4k
- Fork
- 876
- Merge medio
- 8g 4h
- PR unite (30g)
- 1
Descrizione
I recently wanted to collect custom application metrics from a rather large Celery app. I tried several approaches with varying degrees of awkwardness, until finally settling on having a "sidecar" HTTP server process for all Celery nodes.
This works pretty well, but took me a while to get right. To spare others from wasting as much time as me, I would like to propose adding a section on getting Celery metrics set up with the Prometheus client. I wrote up the solution on StackOverflow: https://stackoverflow.com/a/75799358/2532203
If you're interested, I can properly summarise it and open a PR?
Also, if you look at the code, I needed to copy some swaths of the library because the built-in Prometheus WSGI server is hard-coded to demonise the thread; this causes trouble when running in a demonised process. Maybe this could be made optional with another keyword argument that defaults to True?
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con la soluzione di StackOverflow collegata nell’issue e con il riferimento al server WSGI del client Prometheus in exposition.py. Riassumi la configurazione del server HTTP sidecar per raccogliere le metriche dai worker Celery nella sezione appropriata della documentazione e verifica che l’esempio sia completo e comprensibile. Considera il comportamento opzionale di daemon-thread come una questione separata, a meno che la discussione esistente non la risolva.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- prometheus, python
- Ambito
- documentation, observability-sre
- Tipo di issue
- Documentazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Tranquilla
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 55/100