mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-04-23 11:58:56 +02:00
Part of https://github.com/open-telemetry/opentelemetry-go/issues/5249 This makes all existing types designed to implement the public Exemplar API public by moving most of `internal/exemplar` to `exemplar`. The only types that are not being made public are `exemplar.Drop`, and `exemplar.FilteredReservoir`. Those types are moved to `internal/aggregate`, and are renamed to `DropReservoir` and `FilteredExemplarReservoir`. The following types are made public: * `exemplar.Exemplar` * `exemplar.Filter` * `exemplar.SampledFilter` * `exemplar.AlwaysOnFilter` * `exemplar.HistogramReservoir` * `exemplar.FixedSizeReservoir` * `exemplar.Reservoir` * `exemplar.Value` * `exemplar.ValueType`
25 lines
781 B
Go
25 lines
781 B
Go
// Copyright The OpenTelemetry Authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package aggregate // import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate"
|
|
|
|
import (
|
|
"context"
|
|
|
|
"go.opentelemetry.io/otel/attribute"
|
|
"go.opentelemetry.io/otel/sdk/metric/exemplar"
|
|
)
|
|
|
|
// DropReservoir returns a [FilteredReservoir] that drops all measurements it is offered.
|
|
func DropReservoir[N int64 | float64]() FilteredExemplarReservoir[N] { return &dropRes[N]{} }
|
|
|
|
type dropRes[N int64 | float64] struct{}
|
|
|
|
// Offer does nothing, all measurements offered will be dropped.
|
|
func (r *dropRes[N]) Offer(context.Context, N, []attribute.KeyValue) {}
|
|
|
|
// Collect resets dest. No exemplars will ever be returned.
|
|
func (r *dropRes[N]) Collect(dest *[]exemplar.Exemplar) {
|
|
*dest = (*dest)[:0]
|
|
}
|