Skip to content

Latest commit

 

History

History
47 lines (34 loc) · 1.62 KB

File metadata and controls

47 lines (34 loc) · 1.62 KB

OpenTelemetry .NET Diagnostic: OTEL1003

Overview

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.

Details

From the specification:

The cardinality limit for an aggregation is defined in one of three ways:

  1. 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.
  2. 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.
  3. 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.

Setting cardinality limit for a specific Metric via the View API

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();

Setting cardinality limit for a specific MetricReader

This is not currently supported by OpenTelemetry .NET.