Skip to content

feat: use typed Prometheus family descriptors#7487

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

feat: use typed Prometheus family descriptors#7487
zeitlinger wants to merge 11 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>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
@zeitlinger zeitlinger marked this pull request as ready for review June 4, 2026 14:57
zeitlinger added a commit to prometheus/client_java that referenced this pull request Jun 5, 2026
## Summary
- Points the `typed-descriptor` compat matrix leg at the latest head of
[micrometer-metrics/micrometer#7487](micrometer-metrics/micrometer#7487)
(`84092837e`), which now builds against client_java 1.7.0 and uses the
typed `MetricFamilyDescriptor` API.
- Updates renovate `currentValue` to match the actual PR branch
(`feat/prom-client-java-typed-family-descriptor`).

## Test plan
- [ ] Micrometer Compatibility workflow `typed-descriptor` leg passes

---------

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
@shakuzen shakuzen added this to the 1.18.x milestone Jun 5, 2026
@shakuzen
Copy link
Copy Markdown
Member

shakuzen commented Jun 5, 2026

@zeitlinger thank you for the PR. We'll look to review and merge this for the Micrometer 1.18.0 release. In the meantime, dependabot sent a PR to upgrade the Prometheus Java client version to 1.7.0, which was merged automatically since the build passed: #7572. That would be included in the upcoming Micrometer 1.17.0 GA release. Is there any concern about making that upgrade on its own without this PR?

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.

2 participants