MetricLimits
Configuration for metric cardinality limits.
Per OpenTelemetry Metrics SDK specification, metrics need cardinality limits to prevent memory exhaustion from unbounded unique attribute combinations.
When the cardinality limit is exceeded, new attribute combinations are redirected to an overflow aggregator identified by the OVERFLOW_ATTRIBUTE.
Note: Unlike spans and logs, metrics are EXEMPT from attribute count and value length limits per the OTel specification. Only cardinality is limited.
Tags
Constants
- OVERFLOW_ATTRIBUTE = 'otel.metric.overflow'
- Attribute key used to identify overflow aggregations.
Properties
- $cardinalityLimit : int
Methods
- __construct() : mixed
- default() : self
- Create limits with default values.
- unlimited() : self
- Create limits with no cardinality restrictions.
Constants
OVERFLOW_ATTRIBUTE
Attribute key used to identify overflow aggregations.
public
mixed
OVERFLOW_ATTRIBUTE
= 'otel.metric.overflow'
When cardinality limit is exceeded, measurements are aggregated into a synthetic data point with this attribute set to true.
Properties
$cardinalityLimit
public
int
$cardinalityLimit
= self::DEFAULT_CARDINALITY_LIMIT
Methods
__construct()
public
__construct([int $cardinalityLimit = self::DEFAULT_CARDINALITY_LIMIT ]) : mixed
Parameters
- $cardinalityLimit : int = self::DEFAULT_CARDINALITY_LIMIT
-
Maximum number of unique attribute combinations per instrument
default()
Create limits with default values.
public
static default() : self
Return values
selfunlimited()
Create limits with no cardinality restrictions.
public
static unlimited() : self
Warning: This can lead to memory exhaustion with high-cardinality attributes.