TraceBasedExemplarFilter implements ExemplarFilter
Read onlyYes
FinalYes
Records an exemplar only when the span is sampled.
This is the default filter per OpenTelemetry specification. It captures exemplars only for measurements where the associated span has the SAMPLED trace flag set. This provides trace-metric correlation while keeping storage costs aligned with trace sampling.
Interfaces
- ExemplarFilter
- Determines whether an exemplar should be recorded for a metric measurement.
Methods
- __toString() : string
- shouldSample() : bool
- Determine whether to record an exemplar for this measurement.
Methods
__toString()
public
__toString() : string
Return values
stringshouldSample()
Determine whether to record an exemplar for this measurement.
public
shouldSample(SpanContext|null $context, int|float $value, array<string|int, mixed> $attributes) : bool
Parameters
- $context : SpanContext|null
-
The current span context, or null if none
- $value : int|float
-
The measurement value
- $attributes : array<string|int, mixed>
-
The measurement attributes