OpenMetrics 2.0: option to keep _total and unit suffixes, so switching from OM1 doesn't rename series
Mantenedores costumam responder em até 1 dia
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 62/100
- Tipo de issue
- Funcionalidade
- Clareza
- Razoavelmente clara
- Status de atividade
- Ativa
- Stack de tecnologia
- java
- Domínio
- observability-sre
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- Java
- Estrelas
- 2.3k
- Forks
- 833
- Merge médio
- 1d 9h
- PRs com merge (30d)
- 73
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de prometheus/client_java
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
prometheus/client_java#2416 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Switch Micrometer compatibility workflow to upstream once typed-descriptor path becomes defaultTalvez livre de novo Um pull request para esta issue foi fechado sem ser mesclado. Aberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 86/100
prometheus/client_java#2182 ·
Mantenedores costumam responder em até 1 dia
-
Proposal: Prometheus HTTP API client module (prometheus-metrics-api-client)Talvez livre de novo @arnabnandy7 assumiu há 84 dias e não há nenhum pull request aberto. Aberta
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 35/100
prometheus/client_java#2306 · 10 comentários · 4 reações ·
Mantenedores costumam responder em até 1 dia
-
Improve Summary quantiles with DataSketchesTalvez livre de novo @ADITYA-CODE-SOURCE assumiu há 158 dias e não há nenhum pull request aberto. Aberta
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 32/100
prometheus/client_java#2084 · 3 comentários ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 35/100
prometheus/client_java#2075 · 10 comentários · 1 reação ·
Mantenedores costumam responder em até 1 dia
Todas as issues de prometheus/client_java
Issues semelhantes
-
enhancement good first issue
Dificuldade 2/5 Meio dia Facilidade para iniciantes 66/100
apache/fineract-consumer-facing#175 ·
Mantenedores costumam responder em até 1 dia
-
[BUG] 订单:会员凭订单号即可取消其他会员的待付款订单(取消接口不校验订单归属)Talvez já em andamento @dadiyang assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
macrozheng/mall#1016 ·
-
[Bug] The producer summary counts an unreported client version as a second version and warns about a version mixTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
apache/rocketmq-dashboard#6110 ·
Mantenedores costumam responder em até 4 dias
-
Feature:Resolution
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
intellij-elixir/intellij-elixir#4396 ·
Mantenedores costumam responder em até 1 dia
-
Python 3.15 supportTalvez já em andamento @amnesiaof assumiu hoje. AbertaL: python L: python:uv
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
dependabot/dependabot-core#16524 · 1 comentário ·
Mantenedores costumam responder em até 1 dia