-
Notifications
You must be signed in to change notification settings - Fork 863
[sdk-metrics] Obsolete SetMaxMetricPointsPerMetricStream + standarize on "Cardinality Limit" name #5328
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-metrics] Obsolete SetMaxMetricPointsPerMetricStream + standarize on "Cardinality Limit" name #5328
Changes from 1 commit
0e5c749
ce0afe2
5730d14
9bfe6cc
ae6d742
ea6aace
975b90e
d79ca7c
51674e6
8b91bf3
e3eb786
c2f8f88
4596cf1
bab53c9
856446f
6d05f7b
f3218a5
1b6c2a4
ae5c68d
73df3ec
695eb66
f1b62b0
9064b7a
454bd17
87d5875
5cfbf04
c24e42c
8a6d2c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,9 +1,6 @@ | ||||||
| // Copyright The OpenTelemetry Authors | ||||||
| // SPDX-License-Identifier: Apache-2.0 | ||||||
|
|
||||||
| #if EXPOSE_EXPERIMENTAL_FEATURES | ||||||
| using System.ComponentModel; | ||||||
| #endif | ||||||
| #if NET6_0_OR_GREATER | ||||||
| using System.Diagnostics.CodeAnalysis; | ||||||
| #endif | ||||||
|
|
@@ -233,13 +230,16 @@ public static MeterProviderBuilder SetMaxMetricStreams(this MeterProviderBuilder | |||||
| /// This limits the number of unique combinations of key/value pairs used | ||||||
| /// for reporting measurements. | ||||||
| /// </summary> | ||||||
| /// <inheritdoc cref="SetCardinalityLimit(MeterProviderBuilder, int)"/> | ||||||
| /// <remarks> | ||||||
| /// If a particular key/value pair combination is used at least once, | ||||||
| /// it will contribute to the limit for the life of the process. | ||||||
| /// This may change in the future. See: https://github.com/open-telemetry/opentelemetry-dotnet/issues/2360. | ||||||
| /// </remarks> | ||||||
| /// <param name="meterProviderBuilder"><see cref="MeterProviderBuilder"/>.</param> | ||||||
| /// <param name="maxMetricPointsPerMetricStream">Maximum number of metric points allowed per metric stream.</param> | ||||||
| /// <returns>The supplied <see cref="MeterProviderBuilder"/> for chaining.</returns> | ||||||
| #if EXPOSE_EXPERIMENTAL_FEATURES | ||||||
| [Obsolete("Call SetCardinalityLimit instead. This method will be removed in a future version.")] | ||||||
| [EditorBrowsable(EditorBrowsableState.Never)] | ||||||
| [Obsolete("Use MetricStreamConfiguration.CardinalityLimit via the AddView API instead. This method will be removed in a future version.")] | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or combine.. removed in a future version, along with major version bump of the package.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not going to do this here because we use similar a bunch of places but good thing for a follow-up! |
||||||
| #endif | ||||||
| public static MeterProviderBuilder SetMaxMetricPointsPerMetricStream(this MeterProviderBuilder meterProviderBuilder, int maxMetricPointsPerMetricStream) | ||||||
| { | ||||||
|
|
@@ -249,7 +249,7 @@ public static MeterProviderBuilder SetMaxMetricPointsPerMetricStream(this MeterP | |||||
| { | ||||||
| if (builder is MeterProviderBuilderSdk meterProviderBuilderSdk) | ||||||
| { | ||||||
| meterProviderBuilderSdk.SetMaxMetricPointsPerMetricStream(maxMetricPointsPerMetricStream); | ||||||
| meterProviderBuilderSdk.SetDefaultCardinalityLimit(maxMetricPointsPerMetricStream); | ||||||
| } | ||||||
| }); | ||||||
|
|
||||||
|
|
@@ -317,40 +317,6 @@ public static MeterProvider Build(this MeterProviderBuilder meterProviderBuilder | |||||
| throw new NotSupportedException($"Build is not supported on '{meterProviderBuilder?.GetType().FullName ?? "null"}' instances."); | ||||||
| } | ||||||
|
|
||||||
| #if EXPOSE_EXPERIMENTAL_FEATURES | ||||||
| /// <summary> | ||||||
| /// Sets a positive integer value defining the maximum number of | ||||||
| /// data points allowed for metrics managed by the MeterProvider. | ||||||
| /// </summary> | ||||||
| /// <remarks> | ||||||
| /// <para><b>WARNING</b>: This is an experimental API which might change or | ||||||
| /// be removed in the future. Use at your own risk.</para> | ||||||
| /// </remarks> | ||||||
| /// <param name="meterProviderBuilder"><see cref="MeterProviderBuilder"/>.</param> | ||||||
| /// <param name="cardinalityLimit">Cardinality limit.</param> | ||||||
| /// <returns>The supplied <see cref="MeterProviderBuilder"/> for chaining.</returns> | ||||||
| #if NET8_0_OR_GREATER | ||||||
| [Experimental(DiagnosticDefinitions.CardinalityLimitExperimentalApi, UrlFormat = DiagnosticDefinitions.ExperimentalApiUrlFormat)] | ||||||
| #endif | ||||||
| public | ||||||
| #else | ||||||
| internal | ||||||
| #endif | ||||||
| static MeterProviderBuilder SetCardinalityLimit(this MeterProviderBuilder meterProviderBuilder, int cardinalityLimit) | ||||||
| { | ||||||
| Guard.ThrowIfOutOfRange(cardinalityLimit, min: 1, max: int.MaxValue); | ||||||
|
|
||||||
| meterProviderBuilder.ConfigureBuilder((sp, builder) => | ||||||
| { | ||||||
| if (builder is MeterProviderBuilderSdk meterProviderBuilderSdk) | ||||||
| { | ||||||
| meterProviderBuilderSdk.SetCardinalityLimit(cardinalityLimit); | ||||||
| } | ||||||
| }); | ||||||
|
|
||||||
| return meterProviderBuilder; | ||||||
| } | ||||||
|
|
||||||
| #if EXPOSE_EXPERIMENTAL_FEATURES | ||||||
| /// <summary> | ||||||
| /// Sets the <see cref="ExemplarFilter"/> to be used for this provider. | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.