This is an Experimental API diagnostic covering the following API:
MetricStreamConfiguration.CardinalityLimit.get
MetricStreamConfiguration.CardinalityLimit.set
Experimental APIs may be changed or removed in the future.
From the specification:
The cardinality limit for an aggregation is defined in one of three ways:
- A view with criteria matching the instrument an aggregation is created for has an
aggregation_cardinality_limit
value defined for the stream, that value SHOULD be used.- If there is no matching view, but the
MetricReader
defines a default cardinality limit value based on the instrument an aggregation is created for, that value SHOULD be used.- If none of the previous values are defined, the default value of 2000 SHOULD be used.
We are exposing these APIs experimentally until the specification declares them stable.
The OpenTelemetry Specification defines the cardinality limit of a metric can be set by the matching view.
using var meterProvider = Sdk.CreateMeterProviderBuilder()
.AddView(
instrumentName: "MyFruitCounter",
new MetricStreamConfiguration { CardinalityLimit = 10 })
.Build();