Skip to content

Cardinality limits are not configurable per-instrument-kind #524

@dashpole

Description

@dashpole

I'm opening this after reviewing open-telemetry/opentelemetry-go#7855.

The schema appears to currently support configuring cardinality limits differently based on the instrument kind. This is not part of the metrics SDK specification, and should be removed.

default: 100
counter: 2000
gauge: 2000
histogram: 2000
observable_counter: 2000
observable_gauge: 2000
observable_up_down_counter: 2000
up_down_counter: 2000

The PR above referenced this section as the spec as justification:

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.

But this does not suggest that the metric reader needs configuration allowing the cardinality limit to be changed per-instrument-kind. It only suggests that the default value chosen by the SDK can be based on the instrument.

The correct specification for this configuration is here

aggregation_cardinality_limit: A positive integer value defining the
maximum number of data points allowed to be emitted in a collection cycle by
a single instrument. See cardinality limits, below.

Users can provide an aggregation_cardinality_limit, but it is up to their
discretion. Therefore, the stream configuration parameter needs to be
structured to accept an aggregation_cardinality_limit, but MUST NOT
obligate a user to provide one. If the user does not provide an
aggregation_cardinality_limit value, the MeterProvider MUST apply the
default aggregation cardinality limit the MetricReader is
configured with.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions