Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sdk] Added support for setting CardinalityLimit allowed for the metric managed by the view. #5312

Merged
merged 14 commits into from
Feb 6, 2024

Conversation

Yun-Ting
Copy link
Contributor

@Yun-Ting Yun-Ting commented Feb 3, 2024

Changes

Fixes #5296

  • Added support for setting CardinalityLimit allowed for the metric managed by the view.
  • Defined OTEL1003 in docs in experimental API for setting Metric CardinalityLimit.
  • Added .NET 8 ExperimentalAttribute decoration for setting Metric CardinalityLimit.

Merge requirement checklist

  • CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)
  • Unit tests added/updated
  • Appropriate CHANGELOG.md files updated for non-trivial changes
  • Changes in public API reviewed (if applicable)

{
if (value != null)
{
Guard.ThrowIfOutOfRange(value.Value, min: 3, max: int.MaxValue);
Copy link
Member

@reyang reyang Feb 5, 2024

Choose a reason for hiding this comment

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

@Yun-Ting would you put a comment here explaining why min is 3? (consider updating the XML doc to call out the accepted range)

Copy link
Contributor Author

@Yun-Ting Yun-Ting Feb 5, 2024

Choose a reason for hiding this comment

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

Yeah, one for the overflowAttribute when emitOverflowAttribute is set to true, and the other for 0 tag, assuming when users set this value, they want to pass in tags.

Currently, the lower limit for .SetMaxMetricPointsPerMetricStream() is 1, though.

In AggregatorStore, we reserved one for the overflowAttribute.

And in doc, it says one should be reserved for 0 tag (no key/value pair associated).

Also, there had been discussions on whether we should reserve 1 for zero dimension: #2635 (comment).

Maybe this topic indeed worth another PR.

@Yun-Ting Yun-Ting changed the title Add support for setting MaxMetricPoints per MetricStream. Added support for setting CardinalityLimit allowed for the metric managed by the view. Feb 5, 2024
@Yun-Ting Yun-Ting marked this pull request as ready for review February 6, 2024 00:31
@Yun-Ting Yun-Ting requested a review from a team as a code owner February 6, 2024 00:31
Copy link
Member

@reyang reyang left a comment

Choose a reason for hiding this comment

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

LGTM. The current test cases are using reflection, I think eventually we should remove reflection and test against the real limits (e.g. set a limit and see if we hit it or not). Not blocking this PR since it requires many changes in other places (including fixing some bugs).

@CodeBlanch CodeBlanch added the pkg:OpenTelemetry Issues related to OpenTelemetry NuGet package label Feb 6, 2024
@CodeBlanch CodeBlanch changed the title Added support for setting CardinalityLimit allowed for the metric managed by the view. [sdk] Added support for setting CardinalityLimit allowed for the metric managed by the view. Feb 6, 2024
@CodeBlanch CodeBlanch merged commit 8ff986b into open-telemetry:main Feb 6, 2024
49 checks passed
@Yun-Ting Yun-Ting deleted the yunl/metricPointPerView branch February 6, 2024 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
metrics pkg:OpenTelemetry Issues related to OpenTelemetry NuGet package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allowing cardinality limit per View
4 participants