| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
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>
|
Opened #2122 as the smaller alternative implementation for #2114: same typed descriptor API, but legacy snapshot builders remain on plain metadata so the new descriptor behavior is opt-in. #2121 remains the combined validation PR with #2094 + Micrometer compatibility. |
Sorry, something went wrong.
closed that |
Sorry, something went wrong.
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
There was a problem hiding this comment.
This PR introduces a typed, registration-time metadata API (MetricFamilyDescriptor) for collectors and snapshot builders, and updates the registry and core metrics to use/bridge this API while deprecating the older fragmented metadata hooks.
Changes:
Copilot reviewed 36 out of 36 changed files in this pull request and generated 3 comments.
Show a summary per file| File | Description |
|---|---|
| prometheus-metrics-model/src/test/java/io/prometheus/metrics/model/snapshots/SnapshotTestUtil.java | Adds helper assertions for derived metadata fields. |
| prometheus-metrics-model/src/test/java/io/prometheus/metrics/model/snapshots/MetricFamilyDescriptorTest.java | New unit tests for MetricFamilyDescriptor behavior. |
| prometheus-metrics-model/src/test/java/io/prometheus/metrics/model/snapshots/InfoSnapshotTest.java | Updates expectations for derived metadata and stripped _info naming. |
| prometheus-metrics-model/src/test/java/io/prometheus/metrics/model/snapshots/GaugeSnapshotTest.java | Fixes test to use GaugeSnapshot and asserts derived metadata. |
| prometheus-metrics-model/src/test/java/io/prometheus/metrics/model/snapshots/CounterSnapshotTest.java | Adds derived-metadata assertions and counter typed-metadata test. |
| prometheus-metrics-model/src/test/java/io/prometheus/metrics/model/registry/PrometheusRegistryTest.java | Adds registry validation coverage using typed descriptors. |
| prometheus-metrics-model/src/test/java/io/prometheus/metrics/model/registry/OpenTelemetryExporterRegistryCompatibilityTest.java | Suppresses deprecation warnings for legacy API usage in tests. |
| prometheus-metrics-model/src/test/java/io/prometheus/metrics/model/registry/MultiCollectorNameFilterTest.java | Suppresses deprecation warnings for legacy API usage in tests. |
| prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/snapshots/MetricSnapshot.java | Allows subclasses to override metadata building and routes through metadata support. |
| prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/snapshots/MetricMetadataSupport.java | New internal helper for typed metadata derivation (counter/info). |
| prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/snapshots/MetricFamilyDescriptor.java | New typed descriptor API + builders per metric type. |
| prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/snapshots/InfoSnapshot.java | Uses typed metadata derivation for Info snapshots. |
| prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/snapshots/CounterSnapshot.java | Uses typed metadata derivation for Counter snapshots. |
| prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/registry/PrometheusRegistry.java | Switches registration-time validation to use typed descriptors; keeps deprecated fallback for scraping. |
| prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/registry/MultiCollector.java | Adds getMetricFamilyDescriptors() and deprecates fragmented metadata methods. |
| prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/registry/Collector.java | Adds getMetricFamilyDescriptor() and deprecates fragmented metadata methods. |
| prometheus-metrics-instrumentation-guava/src/test/java/io/prometheus/metrics/instrumentation/guava/CacheMetricsCollectorTest.java | Suppresses deprecation warnings. |
| prometheus-metrics-instrumentation-guava/src/main/java/io/prometheus/metrics/instrumentation/guava/CacheMetricsCollector.java | Deprecates getPrometheusNames() in favor of typed descriptors. |
| prometheus-metrics-instrumentation-caffeine/src/test/java/io/prometheus/metrics/instrumentation/caffeine/CacheMetricsCollectorTest.java | Suppresses deprecation warnings. |
| prometheus-metrics-instrumentation-caffeine/src/main/java/io/prometheus/metrics/instrumentation/caffeine/CacheMetricsCollector.java | Deprecates legacy constructor and getPrometheusNames(). |
| prometheus-metrics-exposition-textformats/src/test/java/io/prometheus/metrics/expositionformats/DuplicateNamesExpositionTest.java | Suppresses deprecation warnings. |
| prometheus-metrics-exposition-textformats/src/main/java/io/prometheus/metrics/expositionformats/PrometheusTextFormatWriter.java | Deprecates setTimestampsInMs. |
| prometheus-metrics-exposition-formats/src/test/java/io/prometheus/metrics/expositionformats/DuplicateNamesProtobufTest.java | Suppresses deprecation warnings. |
| prometheus-metrics-core/src/test/java/io/prometheus/metrics/core/metrics/MetricWithFixedMetadataTest.java | New test validating typed-descriptor bridging for legacy overrides. |
| prometheus-metrics-core/src/main/java/io/prometheus/metrics/core/metrics/SummaryWithCallback.java | Uses metadata field directly; deprecates getMetricType(). |
| prometheus-metrics-core/src/main/java/io/prometheus/metrics/core/metrics/Summary.java | Uses metadata field directly; deprecates getMetricType(). |
| prometheus-metrics-core/src/main/java/io/prometheus/metrics/core/metrics/StateSet.java | Uses metadata field directly; deprecates getMetricType(). |
| prometheus-metrics-core/src/main/java/io/prometheus/metrics/core/metrics/StatefulMetric.java | Uses metadata field directly for error messages and properties. |
| prometheus-metrics-core/src/main/java/io/prometheus/metrics/core/metrics/MetricWithFixedMetadata.java | Adds typed descriptor override + deprecates fragmented metadata methods. |
| prometheus-metrics-core/src/main/java/io/prometheus/metrics/core/metrics/Info.java | Uses metadata field directly; deprecates getMetricType(). |
| prometheus-metrics-core/src/main/java/io/prometheus/metrics/core/metrics/Histogram.java | Uses metadata field directly; deprecates getMetricType(). |
| prometheus-metrics-core/src/main/java/io/prometheus/metrics/core/metrics/GaugeWithCallback.java | Uses metadata field directly; deprecates getMetricType(). |
| prometheus-metrics-core/src/main/java/io/prometheus/metrics/core/metrics/Gauge.java | Uses metadata field directly; deprecates getMetricType(). |
| prometheus-metrics-core/src/main/java/io/prometheus/metrics/core/metrics/CounterWithCallback.java | Uses metadata field directly; deprecates getMetricType(). |
| prometheus-metrics-core/src/main/java/io/prometheus/metrics/core/metrics/Counter.java | Uses metadata field directly; deprecates getMetricType(). |
| examples/example-exporter-multi-target/src/main/java/io/prometheus/metrics/examples/multitarget/SampleMultiCollector.java | Deprecates legacy registration-name hook in example. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
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 in `PrometheusNaming.sanitizeMetricName()`). - Micrometer compatibility test tooling/workflow from zeitlinger#1. Local validation: - `mise run lint` - `MICROMETER_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>
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:test` - `mise run lint:fix` - `mise run lint` - `actionlint .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>
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/micrometer` - `MICROMETER_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 lint` - `MICROMETER_DIR=/tmp/micrometer-compat-optin mise run micrometer:test` --------- Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
🤖 I have created a release *beep* *boop* --- ## [1.7.0](v1.6.1...v1.7.0) (2026-06-03) ### Features * Add StableApi marker and API diff check ([#2168](#2168)) ([768fd3a](768fd3a)) * add typed metric family descriptors ([#2114](#2114)) ([9c3b097](9c3b097)) * track api-diff baseline via Renovate and store diffs in docs/apidiffs ([#2174](#2174)) ([3adb890](3adb890)) ### Bug Fixes * **deps:** update dependency com.github.ben-manes.caffeine:caffeine to v3.2.4 ([#2088](#2088)) ([144eb61](144eb61)) * **deps:** update dependency io.dropwizard.metrics:metrics-core to v4.2.39 ([#2139](#2139)) ([5817d13](5817d13)) * **deps:** update dependency io.dropwizard.metrics5:metrics-core to v5.0.7 ([#2140](#2140)) ([261c451](261c451)) * **deps:** update dependency io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha to v2.28.0-alpha ([#2126](#2126)) ([b62b5d0](b62b5d0)) * **deps:** update dependency io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha to v2.28.0-alpha ([#2127](#2127)) ([e11ce3d](e11ce3d)) * **deps:** update dependency io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha to v2.28.1-alpha ([#2132](#2132)) ([b09be38](b09be38)) * **deps:** update dependency io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha to v2.28.1-alpha ([#2133](#2133)) ([a241c16](a241c16)) * **deps:** update dependency org.apache.tomcat.embed:tomcat-embed-core to v11.0.22 ([#2099](#2099)) ([22125c5](22125c5)) * **deps:** update jetty monorepo to v12.1.10 ([#2169](#2169)) ([ddd3991](ddd3991)) * **deps:** update jetty monorepo to v12.1.9 ([#2102](#2102)) ([04bee70](04bee70)) * **deps:** update protobuf ([#2129](#2129)) ([320538a](320538a)) * Reduce allocations for classic histogram buckets ([#2081](#2081)) ([edd160a](edd160a)) * restore legacy suffix compatibility ([#2100](#2100)) ([b2ae70f](b2ae70f)) * restore reserved suffix stripping in `PrometheusNaming.sanitizeMetricName()` ([#2124](#2124)) ([2d0f508](2d0f508)) ### Performance Improvements * Refactored sorting to use optimized sort algorithms ([#2161](#2161)) ([25b94fc](25b94fc)) ### Documentation * clarify downstream adapter validation requirements ([#2101](#2101)) ([ef8c75c](ef8c75c)) * Document OM2 ([#2059](#2059)) ([45d753c](45d753c)) * document PushGateway shading workaround ([#2106](#2106)) ([8ca0eb8](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>
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 in `PrometheusNaming.sanitizeMetricName()`). - Micrometer compatibility test tooling/workflow from zeitlinger#1. Local validation: - `mise run lint` - `MICROMETER_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>
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 `MetricFamilyDescriptor` to 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>
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:test` - `mise run lint:fix` - `mise run lint` - `actionlint .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>
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/micrometer` - `MICROMETER_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 lint` - `MICROMETER_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>
🤖 I have created a release *beep* *boop* --- ## [1.7.0](v1.6.1...v1.7.0) (2026-06-03) ### Features * Add StableApi marker and API diff check ([#2168](#2168)) ([768fd3a](768fd3a)) * add typed metric family descriptors ([#2114](#2114)) ([9c3b097](9c3b097)) * track api-diff baseline via Renovate and store diffs in docs/apidiffs ([#2174](#2174)) ([3adb890](3adb890)) ### Bug Fixes * **deps:** update dependency com.github.ben-manes.caffeine:caffeine to v3.2.4 ([#2088](#2088)) ([144eb61](144eb61)) * **deps:** update dependency io.dropwizard.metrics:metrics-core to v4.2.39 ([#2139](#2139)) ([5817d13](5817d13)) * **deps:** update dependency io.dropwizard.metrics5:metrics-core to v5.0.7 ([#2140](#2140)) ([261c451](261c451)) * **deps:** update dependency io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha to v2.28.0-alpha ([#2126](#2126)) ([b62b5d0](b62b5d0)) * **deps:** update dependency io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha to v2.28.0-alpha ([#2127](#2127)) ([e11ce3d](e11ce3d)) * **deps:** update dependency io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha to v2.28.1-alpha ([#2132](#2132)) ([b09be38](b09be38)) * **deps:** update dependency io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha to v2.28.1-alpha ([#2133](#2133)) ([a241c16](a241c16)) * **deps:** update dependency org.apache.tomcat.embed:tomcat-embed-core to v11.0.22 ([#2099](#2099)) ([22125c5](22125c5)) * **deps:** update jetty monorepo to v12.1.10 ([#2169](#2169)) ([ddd3991](ddd3991)) * **deps:** update jetty monorepo to v12.1.9 ([#2102](#2102)) ([04bee70](04bee70)) * **deps:** update protobuf ([#2129](#2129)) ([320538a](320538a)) * Reduce allocations for classic histogram buckets ([#2081](#2081)) ([edd160a](edd160a)) * restore legacy suffix compatibility ([#2100](#2100)) ([b2ae70f](b2ae70f)) * restore reserved suffix stripping in `PrometheusNaming.sanitizeMetricName()` ([#2124](#2124)) ([2d0f508](2d0f508)) ### Performance Improvements * Refactored sorting to use optimized sort algorithms ([#2161](#2161)) ([25b94fc](25b94fc)) ### Documentation * clarify downstream adapter validation requirements ([#2101](#2101)) ([ef8c75c](ef8c75c)) * Document OM2 ([#2059](#2059)) ([45d753c](45d753c)) * document PushGateway shading workaround ([#2106](#2106)) ([8ca0eb8](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>
## Summary - update `getting-started/registry.md` to recommend `getMetricFamilyDescriptor()` for custom collectors, with a short example and a note that the fragmented `getPrometheusName()/getMetricType()/getLabelNames()/getMetadata()` methods are deprecated but still bridged - update `internals/model.md` to reference `getMetricFamilyDescriptor()` - add `internals/stability.md` covering `@StableApi`, `mise run api-diff`, the baseline tracked in `pom.xml` (Renovate-managed) with diffs under `docs/apidiffs/`, and the `breaking-api-change-accepted` label Covers user-facing changes since v1.6.1: - #2114 — typed metric family descriptors - #2168 — `@StableApi` marker and API diff check ## Test plan - [ ] preview rendered docs locally - [ ] verify intra-doc links resolve Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
| Back | FazBrowse Home | New Git URL |
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: