Skip to content

otelconf: implement cardinality_limits support in PeriodicMetricReader#8885

Merged
pellared merged 8 commits into
open-telemetry:mainfrom
sonalgaud12:cardinality
May 27, 2026
Merged

otelconf: implement cardinality_limits support in PeriodicMetricReader#8885
pellared merged 8 commits into
open-telemetry:mainfrom
sonalgaud12:cardinality

Conversation

@sonalgaud12
Copy link
Copy Markdown
Contributor

#8400

Wire cardinality_limits from PeriodicMetricReader config into the SDK via sdkmetric.WithCardinalityLimitSelector.

Adds selector implementation with per-kind, default, and SDK fallback behavior, along with tests.

@sonalgaud12 sonalgaud12 requested review from a team and pellared as code owners April 29, 2026 19:08
@github-actions github-actions Bot requested a review from codeboten April 29, 2026 19:08
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.6%. Comparing base (cd417e4) to head (39d0d99).

Additional details and impacted files

Impacted file tree graph

@@          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           
Files with missing lines Coverage Δ
otelconf/metric.go 91.6% <100.0%> (+0.8%) ⬆️
otelconf/x/metric.go 91.4% <100.0%> (+0.7%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.CardinalityLimits into the SDK periodic reader options.
  • Add cardinalityLimitSelector helper 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.

Comment thread otelconf/metric.go Outdated
Comment thread otelconf/x/metric.go Outdated
Comment thread otelconf/metric_test.go
Comment thread otelconf/x/metric_test.go
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.CardinalityLimits into sdkmetric.NewPeriodicReader options in both otelconf and otelconf/x.
  • Add a cardinalityLimitSelector implementation 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.

Copy link
Copy Markdown
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @sonalgaud12! Looks like it needs a rebase

@sonalgaud12
Copy link
Copy Markdown
Contributor Author

@pellared can you review this, please?

@pellared pellared added this to the v1.44.0 milestone May 27, 2026
@pellared pellared merged commit a51a867 into open-telemetry:main May 27, 2026
29 checks passed
@sonalgaud12 sonalgaud12 deleted the cardinality branch May 31, 2026 10:04
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.

5 participants