expfmt: TextParser cost grows quadratically with the number of labels on a sample
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 72/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- go, yaml
調査の方向性
二次的な重複チェックは、expfmt のテキストパーサー(prometheus/common の expfmt/text_parse.go)内の startLabelName にあります。まずこの関数を読み、その後、各サンプルに対してこれを呼び出すラベル読み取りループを読んでください。完了の条件は、サンプルごとに1つのセットを保持し、ラベル名ごとに1回だけ挿入すること、既存のテキストパーサーのテストが引き続き通ること、そして40ラベルのゲージがより安価になったことを示すベンチマークがあることです。
索引モデルが issue の本文から書いたものです。
説明
The text parser checks each label name of a sample for duplicates in startLabelName. At each label it builds a new map of all the labels read so far, so a sample with n labels costs n maps and n(n+1)/2 inserts: 136 for 16 labels, 820 for 40.
Info-style metrics often carry many labels. vLLM exposes vllm:cache_config_info as one sample with 40 labels, and a scraper built on this parser parses it on every scrape. In llm-d's endpoint picker, which parses a few families from each vLLM endpoint every 50 ms, this line is half of the scrape CPU.
TextParser.TextToMetricFamilies on v0.74.0 with model.UTF8Validation, a new parser per iteration, Go 1.27.0 on darwin/arm64 (Apple M5), medians of six runs:
| input | time | allocated | allocations |
|---|---|---|---|
| gauge, 1 label | 1.0 µs | 5.4 KB | 36 |
| gauge, 16 labels | 6.9 µs | 13.5 KB | 173 |
| gauge, 40 labels | 35.5 µs | 73.0 KB | 487 |
vllm:cache_config_info from vLLM 0.34 (HELP, TYPE and the 40-label sample) |
41 µs | 73.6 KB | 492 |
vLLM 0.34 /metrics page, 643 lines |
614 µs | 589 KB | 16,301 |
the same page without vllm:cache_config_info |
553 µs | 520 KB | 15,818 |
Above the 1-label line, going from 16 to 40 labels multiplies the time by 5.9, close to the 6.0 ratio of the insert counts. In a CPU profile of the 40-label gauge, startLabelName takes 86% of the time spent in TextToMetricFamilies and 90% of the allocated bytes. On the full vLLM page, the one 40-label line accounts for 12% of the bytes the parser allocates.
Keeping one set per sample and adding each label name as it is read would make the check one insert per label.
- 主要言語
- Go
- スター
- 297
- フォーク
- 380
- 平均マージ
- 3日 18時間
- マージ済み PR(30日)
- 12
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
prometheus/common のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
prometheus/common#1023 ·
メンテナーはふだん 2 日以内に返信
-
expfmt: OpenMetrics 1.0 output with a unit that is not a name suffix fails the whole scrape in Prometheus対応中かも @itsmeasadali が 42 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 58/100
prometheus/common#1005 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 52/100
prometheus/common#876 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
Feature request: Add client_assertion field for oauth2 jwt-bearer grant type対応中かも @alliasgher が 220 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
prometheus/common#869 ·
メンテナーはふだん 2 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
prometheus/common#858 ·
メンテナーはふだん 2 日以内に返信
prometheus/common の issue をすべて見る
似ている issue
-
難易度 2/5 半日 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
keyxmakerx/Chronicle#2616 ·
メンテナーはふだん 1 日以内に返信
-
tech-debt
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
internal/mcp: an exported-but-empty env var is reported as configured but never injected対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンgo good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信