feat: add typed metric family descriptors by zeitlinger · Pull Request #2114 · prometheus/client_java (original) (raw)
added 3 commits
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
This was referenced
May 13, 2026
Signed-off-by: Gregor Zeitlinger gregor.zeitlinger@grafana.com
zeitlinger added a commit that referenced this pull request
Draft validation PR for the unmodified Micrometer compatibility story.
This intentionally does not depend on #2114. Vanilla Micrometer does not use the typed descriptor API and does not implement the #1800 registration metadata hooks, so this PR validates the patch-compatible path independently of typed descriptors.
This validates upstream micrometer-metrics/micrometer@main against:
- current
main, which already includes #2100 and #2124 (reserved suffix stripping inPrometheusNaming.sanitizeMetricName()). - Micrometer compatibility test tooling/workflow from zeitlinger#1.
Local validation:
mise run lintMICROMETER_DIR=/tmp/micrometer-compat-vanilla-2124 mise run micrometer:test
Signed-off-by: Gregor Zeitlinger gregor.zeitlinger@grafana.com Co-authored-by: Jay DeLuca jaydeluca4@gmail.com
Signed-off-by: Gregor Zeitlinger gregor.zeitlinger@grafana.com
zeitlinger deleted the feat/typed-metric-family-descriptor branch
zeitlinger added a commit that referenced this pull request
Draft validation PR for the unmodified JMX Exporter compatibility story.
This intentionally does not depend on #2114. Vanilla JMX Exporter does not use the typed descriptor API, so this PR validates the patch-compatible path independently of typed descriptors.
This validates upstream prometheus/jmx_exporter@main against current
client_java by installing local io.prometheus artifacts and running
the JMX
Exporter collector/common/javaagent/standalone Maven tests against them.
Local validation:
mise run jmx-exporter:testmise run lint:fixmise run lintactionlint .github/workflows/jmx-exporter-compatibility.yml
Signed-off-by: Gregor Zeitlinger gregor.zeitlinger@grafana.com Co-authored-by: Doug Hoard dhoard@users.noreply.github.com
zeitlinger added a commit that referenced this pull request
Draft validation PR for the downstream opt-in path.
Depends on #2114 for the typed descriptor implementation. This branch is stacked on the #2114 head, so once #2114 lands this PR should shrink to only the Micrometer opt-in compatibility tooling.
This validates Micrometer using the new descriptor API, defaulting to:
MICROMETER_REPOSITORY=zeitlinger/micrometerMICROMETER_REF=feat/prometheus-client-opt-in
That Micrometer branch provides MetricFamilyDescriptor metadata from
the Prometheus registry without invoking scrape/sample callbacks during
registration.
Local validation:
mise run lintMICROMETER_DIR=/tmp/micrometer-compat-optin mise run micrometer:test
Signed-off-by: Gregor Zeitlinger gregor.zeitlinger@grafana.com
zeitlinger added a commit that referenced this pull request
jaydeluca added a commit that referenced this pull request
Draft validation PR for the unmodified Micrometer compatibility story.
This intentionally does not depend on #2114. Vanilla Micrometer does not use the typed descriptor API and does not implement the #1800 registration metadata hooks, so this PR validates the patch-compatible path independently of typed descriptors.
This validates upstream micrometer-metrics/micrometer@main against:
- current
main, which already includes #2100 and #2124 (reserved suffix stripping inPrometheusNaming.sanitizeMetricName()). - Micrometer compatibility test tooling/workflow from zeitlinger#1.
Local validation:
mise run lintMICROMETER_DIR=/tmp/micrometer-compat-vanilla-2124 mise run micrometer:test
Signed-off-by: Gregor Zeitlinger gregor.zeitlinger@grafana.com Co-authored-by: Jay DeLuca jaydeluca4@gmail.com Signed-off-by: Jay DeLuca jaydeluca4@gmail.com
jaydeluca pushed a commit that referenced this pull request
Adds typed metric family descriptors and typed metadata support for the model snapshots.
This is the typed-descriptor branch for downstreams that want to provide registration-time metadata explicitly. The #1800 Collector/MultiCollector registration metadata hooks are already optional via default methods, so unmodified downstreams should not need this PR just to keep working.
This PR now also deprecates the fragmented registration metadata API
(getPrometheusName(), getMetricType(), getLabelNames(), and
getMetadata() plus the MultiCollector variants) in favor of
getMetricFamilyDescriptor() / getMetricFamilyDescriptors(). The
deprecated methods remain bridged by default implementations for
compatibility.
Related validation:
- #2121 validates unmodified Micrometer independently of #2114, against
main+ #2124. - #2123 validates a Micrometer branch that explicitly uses
MetricFamilyDescriptorto implement the existing registration metadata hooks without invoking scrape/sample callbacks during registration.
Signed-off-by: Gregor Zeitlinger gregor.zeitlinger@grafana.com Signed-off-by: Jay DeLuca jaydeluca4@gmail.com
jaydeluca pushed a commit that referenced this pull request
Draft validation PR for the unmodified JMX Exporter compatibility story.
This intentionally does not depend on #2114. Vanilla JMX Exporter does not use the typed descriptor API, so this PR validates the patch-compatible path independently of typed descriptors.
This validates upstream prometheus/jmx_exporter@main against current
client_java by installing local io.prometheus artifacts and running
the JMX
Exporter collector/common/javaagent/standalone Maven tests against them.
Local validation:
mise run jmx-exporter:testmise run lint:fixmise run lintactionlint .github/workflows/jmx-exporter-compatibility.yml
Signed-off-by: Gregor Zeitlinger gregor.zeitlinger@grafana.com Co-authored-by: Doug Hoard dhoard@users.noreply.github.com Signed-off-by: Jay DeLuca jaydeluca4@gmail.com
jaydeluca pushed a commit that referenced this pull request
Draft validation PR for the downstream opt-in path.
Depends on #2114 for the typed descriptor implementation. This branch is stacked on the #2114 head, so once #2114 lands this PR should shrink to only the Micrometer opt-in compatibility tooling.
This validates Micrometer using the new descriptor API, defaulting to:
MICROMETER_REPOSITORY=zeitlinger/micrometerMICROMETER_REF=feat/prometheus-client-opt-in
That Micrometer branch provides MetricFamilyDescriptor metadata from
the Prometheus registry without invoking scrape/sample callbacks during
registration.
Local validation:
mise run lintMICROMETER_DIR=/tmp/micrometer-compat-optin mise run micrometer:test
Signed-off-by: Gregor Zeitlinger gregor.zeitlinger@grafana.com Signed-off-by: Jay DeLuca jaydeluca4@gmail.com
jaydeluca pushed a commit that referenced this pull request
🤖 I have created a release beep boop
1.7.0 (2026-06-03)
Features
- Add StableApi marker and API diff check (#2168) (768fd3a)
- add typed metric family descriptors (#2114) (9c3b097)
- track api-diff baseline via Renovate and store diffs in docs/apidiffs (#2174) (3adb890)
Bug Fixes
- deps: update dependency com.github.ben-manes.caffeine:caffeine to v3.2.4 (#2088) (144eb61)
- deps: update dependency io.dropwizard.metrics:metrics-core to v4.2.39 (#2139) (5817d13)
- deps: update dependency io.dropwizard.metrics5:metrics-core to v5.0.7 (#2140) (261c451)
- deps: update dependency io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha to v2.28.0-alpha (#2126) (b62b5d0)
- deps: update dependency io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha to v2.28.0-alpha (#2127) (e11ce3d)
- deps: update dependency io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha to v2.28.1-alpha (#2132) (b09be38)
- deps: update dependency io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha to v2.28.1-alpha (#2133) (a241c16)
- deps: update dependency org.apache.tomcat.embed:tomcat-embed-core to v11.0.22 (#2099) (22125c5)
- deps: update jetty monorepo to v12.1.10 (#2169) (ddd3991)
- deps: update jetty monorepo to v12.1.9 (#2102) (04bee70)
- deps: update protobuf (#2129) (320538a)
- Reduce allocations for classic histogram buckets (#2081) (edd160a)
- restore legacy suffix compatibility (#2100) (b2ae70f)
- restore reserved suffix stripping in
PrometheusNaming.sanitizeMetricName()(#2124) (2d0f508)
Performance Improvements
Documentation
- clarify downstream adapter validation requirements (#2101) (ef8c75c)
- Document OM2 (#2059) (45d753c)
- document PushGateway shading workaround (#2106) (8ca0eb8)
[!IMPORTANT] Close and reopen this PR to trigger CI checks.
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Gregor Zeitlinger gregor.zeitlinger@grafana.com Signed-off-by: Jay DeLuca jaydeluca4@gmail.com
zeitlinger added a commit that referenced this pull request
Summary
- update
getting-started/registry.mdto recommendgetMetricFamilyDescriptor()for custom collectors, with a short example and a note that the fragmentedgetPrometheusName()/getMetricType()/getLabelNames()/getMetadata()methods are deprecated but still bridged - update
internals/model.mdto referencegetMetricFamilyDescriptor() - add
internals/stability.mdcovering@StableApi,mise run api-diff, the baseline tracked inpom.xml(Renovate-managed) with diffs underdocs/apidiffs/, and thebreaking-api-change-acceptedlabel
Covers user-facing changes since v1.6.1:
Test plan
- preview rendered docs locally
- verify intra-doc links resolve
Signed-off-by: Gregor Zeitlinger gregor.zeitlinger@grafana.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})