Skip to content

feat: add typed metric family descriptors#2114

Draft
zeitlinger wants to merge 3 commits into
prometheus:mainfrom
zeitlinger:feat/typed-metric-family-descriptor
Draft

feat: add typed metric family descriptors#2114
zeitlinger wants to merge 3 commits into
prometheus:mainfrom
zeitlinger:feat/typed-metric-family-descriptor

Conversation

@zeitlinger
Copy link
Copy Markdown
Member

Summary

  • add a typed MetricFamilyDescriptor registration-time API in prometheus-metrics-model
  • reuse the same typed metadata derivation rules as the snapshot builders
  • cover the new descriptor API with model tests

Why

This is the end-state API for descriptor-first consumers such as Micrometer.
It removes the need for downstreams to reconstruct MetricMetadata internals
from suffix-heavy name handling at registration time.

Notes

  • CounterSnapshot.Builder and InfoSnapshot.Builder continue to own scrape-time typed derivation
  • MetricFamilyDescriptor provides the matching registration-time typed entry point
  • this is intended to be paired with a downstream Micrometer draft that links against this PR

Validation

  • ./mvnw test -pl prometheus-metrics-model -Dtest=MetricMetadataTest,CounterSnapshotTest,GaugeSnapshotTest,InfoSnapshotTest,MetricFamilyDescriptorTest,PrometheusRegistryTest -Dcoverage.skip=true -Dcheckstyle.skip=true
  • mise run build

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