typelevel / otel4s

An OpenTelemetry library for Scala based on Cats-Effect
https://typelevel.org/otel4s
Apache License 2.0
162 stars 30 forks source link

Metrics SDK: don't create exemplar reservoirs when exemplars are disabled #664

Closed iRevive closed 2 months ago

iRevive commented 2 months ago

Currently, we create a reservoir and apply the filter afterward: 1) SumAggregator 2) ExplicitBucketHistogramAggregator

But there is no need to create a reservoir at all in the following scenarios: 1) If an exemplar filter is alwaysOff - use a noop reservoir 2) If an exemplar filter is traceBased and TraceContextLookup is Noop - use a noop reservoir