prometheus / prometheus/client_python
Aggregate expired pid db files, control the number of files and improve scrape effectiveness
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 4.4k
- フォーク
- 876
- 平均マージ
- 8日 4時間
- マージ済み PR(30日)
- 1
説明
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
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず履歴関連の pull request #441 と #430 を確認し、次に 128 ワーカーの Gunicorn デプロイメントについて説明されている Python の集約および scrape の動作を追跡してください。提案されている定期的な集約と削除のアプローチを、Grafana の現在のメトリクス結果と比較してください。完了の条件は、pid データベースファイルのサイズが上限内に収まり、過去の値が保持され、scrape 時間が 1 秒未満であることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- django, go, grafana, prometheus, python
- 領域
- backend, observability, performance
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100