Skip to content

Commit ef8c75c

Browse files
authored
docs: clarify downstream adapter validation requirements (#2101)
## Summary - document that downstream `MultiCollector` adapters must expose registration metadata that matches the metric families they emit at scrape time - make the newer suffix/collision validation model more explicit for adapter maintainers ## Why - the existing release notes already describe the suffix-handling and collision-model change - what was missing was explicit guidance that downstream adapters also need their registration-time metadata to stay aligned with emitted `MetricSnapshot` families ## Testing - `mise run lint`
1 parent b5137b2 commit ef8c75c

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@
2525
> To keep the Prometheus and OM1 output unambiguous, the registry tracks claimed exposition names
2626
> and still rejects registrations that would collide at scrape time.
2727
>
28+
> Downstream adapter libraries that implement `MultiCollector` need their registration-time
29+
> metadata to match the metric families they emit at scrape time. When upgrading to 1.6.0+, adapter
30+
> registration metadata needs to stay aligned with emitted names, types, label names, and suffix
31+
> behavior under the new collision model.
32+
> See also: [Validation at registration only](docs/content/getting-started/registry.md#validation-at-registration-only)
33+
>
2834
> | Example | Before 1.6.0 | Since 1.6.0 | Reason |
2935
> | --- | --- | --- | --- |
3036
> | `Gauge("foo_total")` | Rejected | Allowed | Not breaking because this previously failed at registration, so no working setup changes behavior, and safe because `_total` suffix expansion applies to counters, not gauges. |

docs/content/getting-started/registry.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,14 @@ and full label-schema validation and duplicate detection still apply. A collecto
116116
non-null type but leaves `getLabelNames()` as `null` is still validated, with its labels treated as
117117
empty.
118118

119+
This is also relevant for downstream adapter libraries that bridge to this registry. If an adapter
120+
implements `MultiCollector`, its registration-time metadata must match the metric families it will
121+
actually emit at scrape time. In practice, that means `getPrometheusNames()`, `getMetricType(...)`,
122+
`getLabelNames(...)`, and `getMetadata(...)` need to describe the same names, types, labels, and
123+
suffix behavior as the eventual `MetricSnapshot` output. Otherwise an adapter may pass or fail
124+
collision checks differently after upgrading to a newer client_java release, even if its scrape
125+
output logic did not change.
126+
119127
## Unregistering a Metric
120128

121129
There is no automatic expiry of unused metrics (yet), once a metric is registered it will remain

0 commit comments

Comments
 (0)