Skip to content

feat: use typed Prometheus family descriptors#7487

Draft
zeitlinger wants to merge 9 commits into
micrometer-metrics:mainfrom
zeitlinger:feat/prom-client-java-typed-family-descriptor
Draft

feat: use typed Prometheus family descriptors#7487
zeitlinger wants to merge 9 commits into
micrometer-metrics:mainfrom
zeitlinger:feat/prom-client-java-typed-family-descriptor

Conversation

@zeitlinger
Copy link
Copy Markdown
Contributor

Summary

This is a cleaner follow-up to the Prometheus metadata compatibility work for Micrometer.

Instead of reconstructing MetricMetadata from Micrometer-side suffix logic, this change switches the Prometheus registry integration to use the new typed registration descriptor API from client_java.

Depends on:

Related context:

What changed

  • replace Micrometer's stored registration metadata shape with MetricFamilyDescriptor
  • remove Micrometer-side MetricMetadata reconstruction for registration metadata
  • derive registration metadata directly from the typed descriptor API
  • keep scrape-time snapshot creation on typed snapshot builders
  • add/update registration collision coverage in Prometheus registry tests

Why

Micrometer needs registration-time family metadata for collision validation, but the old shape forced Micrometer to duplicate Prometheus naming derivation details.

With client_java exposing typed family descriptors, Micrometer can now treat Prometheus metadata as an upstream concern instead of rebuilding it locally.

Validation

Tested locally against a locally installed prometheus/client_java 1.6.2-SNAPSHOT containing the descriptor API from prometheus/client_java#2114:

./gradlew --no-build-cache \
  -I /tmp/micrometer-prom-local.init.gradle \
  :micrometer-registry-prometheus:test \
  --tests io.micrometer.prometheusmetrics.MicrometerCollectorTest \
  --tests io.micrometer.prometheusmetrics.PrometheusMeterRegistryTest

Notes

  • This draft PR is expected to need prometheus/client_java#2114 first.
  • Until that API is released, this branch is primarily for review of the end-state design.

zeitlinger added 9 commits May 4, 2026 11:41
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant