OpenMetrics 2.0: option to keep _total and unit suffixes, so switching from OM1 doesn't rename series
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 62/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- java
調査の方向性
Start with OpenMetrics2TextFormatWriter.java and OpenMetrics2Properties, then compare their behavior with the OM1 expositionBaseName logic. Review docs/content/exporters/openmetrics2.md for the current naming contract. Done means OM2 can preserve _total and unit suffixes for existing metrics, with a documented default or opt-out matching the chosen design.
索引モデルが issue の本文から書いたものです。
説明
With io.prometheus.openmetrics2.enabled, the OM2 writer exposes names exactly as passed to the builder. It never appends _total or the unit suffix:
This is documented in https://github.com/prometheus/client_java/blob/9e9deb6b9e591c2a62b12882d8a987f120661b71/docs/content/exporters/openmetrics2.md#L57-L77, e.g. Counter("req").unit(BYTES) is req_bytes_total in OM1 but req in OM2.
The problem is that switching a target from OM1 to OM2 renames every counter, and every metric with a unit, that was instrumented the way client_java has always recommended (Counter.builder().name("events")). Prometheus then stores them as new series, so existing queries, dashboards and alerts silently stop matching.
[!NOTE]
I hit this with a demo that scrapes the same client_java app with OM1 and OM2 and diffs the stored series: the JVM metrics match (they already have the suffixes in their names), buthttp_requests_total(OM1) becamehttp_requests(OM2), andhttp_request_size_bytes_totalbecamehttp_request_size. Demo: https://35-204-166-191.sslip.io/, code: https://github.com/bwplotka/prometheus/pull/7.
The OM2 spec relaxed _total and the unit suffix from MUST to SHOULD, mainly for OpenTelemetry compatibility (https://github.com/prometheus/docs/blob/605cf81fefc2e8e91f8ba89bb1555ae52a43a318/docs/guides/open_metrics_2_0_migration.md?plain=1#L140). Both are still recommended though (https://github.com/prometheus/docs/blob/605cf81fefc2e8e91f8ba89bb1555ae52a43a318/docs/specs/om/open_metrics_spec_2_0.md?plain=1#L220 and https://github.com/prometheus/docs/blob/605cf81fefc2e8e91f8ba89bb1555ae52a43a318/docs/specs/om/open_metrics_spec_2_0.md?plain=1#L664). Today there is no way to get them in OM2 other than renaming every metric in code; OpenMetrics2Properties has no option for it.
Proposal:
- add a property, e.g.
io.prometheus.openmetrics2.suffixes(or a naming mode), that keeps the OM1 suffix behaviour in the OM2 writer: append_totalto counters and the unit suffix where missing, asexpositionBaseNamealready does for OM1. - I'd argue it should default to on, so that negotiating OM2 doesn't change any series names, and users who want names exactly as written (e.g. for OTel-style names) can opt out.
For comparison, client_golang keeps the names users register (which by convention include _total and the unit), so there OM1 and OM2 produce the same series.
- 主要言語
- Java
- スター
- 2.3k
- フォーク
- 833
- 平均マージ
- 1日 9時間
- マージ済み PR(30日)
- 73
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
prometheus/client_java のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
prometheus/client_java#2416 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Switch Micrometer compatibility workflow to upstream once typed-descriptor path becomes default再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 86/100
prometheus/client_java#2182 ·
メンテナーはふだん 1 日以内に返信
-
Proposal: Prometheus HTTP API client module (prometheus-metrics-api-client)再び着手できるかも @arnabnandy7 が 82 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
prometheus/client_java#2306 · コメント 10 件 · リアクション 4 件 ·
メンテナーはふだん 1 日以内に返信
-
Improve Summary quantiles with DataSketches再び着手できるかも @ADITYA-CODE-SOURCE が 156 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 5/5 1週間以上 初心者へのやさしさ 32/100
prometheus/client_java#2084 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
prometheus/client_java#2075 · コメント 10 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
prometheus/client_java の issue をすべて見る
似ている issue
-
backend
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
bcgov/nr-forest-client#2524 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
team:Lumberjack
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
OpenLiberty/open-liberty#35998 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] SQS SendMessageBatch accepts more than 10 entries instead of TooManyEntriesInBatchRequestオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
floci-io/floci#5319 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信