otelconf: implement cardinality_limits support in PeriodicMetricReader#8885
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8885 +/- ##
=====================================
Coverage 83.6% 83.6%
=====================================
Files 195 195
Lines 15962 16020 +58
=====================================
+ Hits 13348 13406 +58
Misses 2140 2140
Partials 474 474
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Implements support for cardinality_limits in PeriodicMetricReader configuration by wiring limits into the OpenTelemetry Go SDK via sdkmetric.WithCardinalityLimitSelector, including selector logic and tests in both otelconf and otelconf/x.
Changes:
- Wire
PeriodicMetricReader.CardinalityLimitsinto the SDK periodic reader options. - Add
cardinalityLimitSelectorhelper implementing per-kind, default, and SDK/provider-fallback behavior. - Add/extend unit tests for selector behavior and config wiring scenarios; update changelog entry.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| otelconf/metric.go | Adds WithCardinalityLimitSelector(...) wiring + selector helper for otelconf. |
| otelconf/metric_test.go | Adds reader test cases and a dedicated TestCardinalityLimitSelector. |
| otelconf/x/metric.go | Adds WithCardinalityLimitSelector(...) wiring + selector helper for otelconf/x. |
| otelconf/x/metric_test.go | Adds reader test cases and a dedicated TestCardinalityLimitSelector. |
| CHANGELOG.md | Documents the new cardinality_limits support. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Implements support for cardinality_limits on PeriodicMetricReader configs by wiring them into the OpenTelemetry Go SDK via sdkmetric.WithCardinalityLimitSelector, ensuring per-instrument-kind and default behaviors are respected.
Changes:
- Wire
PeriodicMetricReader.CardinalityLimitsintosdkmetric.NewPeriodicReaderoptions in bothotelconfandotelconf/x. - Add a
cardinalityLimitSelectorimplementation that applies per-kind limits, then.default, then falls back to SDK/provider behavior. - Add unit and wiring/integration tests validating selector behavior and that limits are actually applied by the SDK reader.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| otelconf/metric.go | Wires CardinalityLimits into PeriodicReader options and adds selector helper. |
| otelconf/metric_test.go | Adds selector tests plus an integration-style wiring test to ensure SDK behavior changes. |
| otelconf/x/metric.go | Mirrors otelconf wiring/selector behavior for the experimental package. |
| otelconf/x/metric_test.go | Mirrors selector and wiring tests for otelconf/x. |
| CHANGELOG.md | Documents the newly added cardinality_limits support for PeriodicMetricReader. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
codeboten
left a comment
There was a problem hiding this comment.
Thanks @sonalgaud12! Looks like it needs a rebase
|
@pellared can you review this, please? |
#8400
Wire
cardinality_limitsfromPeriodicMetricReaderconfig into the SDK viasdkmetric.WithCardinalityLimitSelector.Adds selector implementation with per-kind, default, and SDK fallback behavior, along with tests.