Skip to content

feat: add compile-time enum dimension labels via MetricDimension trait#99

Open
brayniac wants to merge 9 commits into
iopsystems:mainfrom
brayniac:feat/metric-dimension
Open

feat: add compile-time enum dimension labels via MetricDimension trait#99
brayniac wants to merge 9 commits into
iopsystems:mainfrom
brayniac:feat/metric-dimension

Conversation

@brayniac

@brayniac brayniac commented May 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds MetricDimension trait mapping enum variants to dense array indices and label strings, with a cartesian-product (A, B) tuple impl for multi-dimensional metrics
  • Adds DimensionedCounter<D>, DimensionedGauge<D>, and DimensionedHistogram<D> wrappers that use D: MetricDimension to provide named accessor methods over the underlying CounterGroup/GaugeGroup/HistogramGroup
  • Adds #[derive(MetricDimension)] proc macro for enums so callers avoid hand-writing the trait impl

Test Plan

  • cargo nextest run --all-targets --all-features --locked — 84 tests pass
  • cargo clippy --all-targets --all-features — clean
  • cargo fmt --all -- --check — clean
  • Integration tests in metriken/tests/dimensioned_metrics.rs cover single-dimension and cartesian-product usage, inc. .value(), .set(), .increment(), .add(), and metadata propagation

🤖 Generated with Claude Code

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