prometheus / prometheus/client_python
Aggregate expired pid db files, control the number of files and improve scrape effectiveness
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 4.4k
- Fork
- 876
- Merge medio
- 8g 4h
- PR unite (30g)
- 1
Descrizione
history related issues: https://github.com/prometheus/client_python/pull/441
https://github.com/prometheus/client_python/pull/430
Can we aggregate all the db files from a period of time ago and non-current pid into a total db file, to control the number of pid files ?
I have realized this idea with golang,here are some details:
Project deploy info:
gunicorn django
128 workers
gunicorn max_requests:10000(create a new pid file almost every minute)
- I can't solve the problem that the pid file has been growing, and it can reach 6,000 in four days;
- Try to delete the expired pid regularly in the code, but it will cause the figure to drop with grafana;
- The time to request metric is getting longer as the program runs.
Improve scrape efficiency:
I used golang to rewrite the logic of python aggregate metrics(generate metric still using python). After rewriting, each scrape time is less than 1 second.
Solve the growing pid files:
Aggregate all the db files from a period of time ago and non-current pid into a total db file. Then delete these files. When calculating metric, history total db + curent pid = current pid db. (i do it every hour)
Now, num of pid files is <200 in my project. if we can do change this, it would be a big strengthen. Just like prometheus will also aggregate historical data
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 esaminando le pull request relative alla cronologia #441 e #430, quindi ricostruisci il comportamento di aggregazione e scrape in Python descritto per il deployment Gunicorn con 128 worker. Confronta l’approccio proposto di aggregazione ed eliminazione periodiche con i risultati attuali delle metriche in Grafana; il lavoro è completato quando i file del database pid hanno dimensioni limitate, i valori storici sono preservati e il tempo di scrape è inferiore a un secondo.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- django, go, grafana, prometheus, python
- Ambito
- backend, observability, performance
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100