You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-11-06 09:09:44 +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`
33 lines
1.0 KiB
Go
33 lines
1.0 KiB
Go
// Copyright The OpenTelemetry Authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package exemplar // import "go.opentelemetry.io/otel/sdk/metric/exemplar"
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"go.opentelemetry.io/otel/attribute"
|
|
)
|
|
|
|
// Reservoir holds the sampled exemplar of measurements made.
|
|
type Reservoir interface {
|
|
// Offer accepts the parameters associated with a measurement. The
|
|
// parameters will be stored as an exemplar if the Reservoir decides to
|
|
// sample the measurement.
|
|
//
|
|
// The passed ctx needs to contain any baggage or span that were active
|
|
// when the measurement was made. This information may be used by the
|
|
// Reservoir in making a sampling decision.
|
|
//
|
|
// The time t is the time when the measurement was made. The val and attr
|
|
// parameters are the value and dropped (filtered) attributes of the
|
|
// measurement respectively.
|
|
Offer(ctx context.Context, t time.Time, val Value, attr []attribute.KeyValue)
|
|
|
|
// Collect returns all the held exemplars.
|
|
//
|
|
// The Reservoir state is preserved after this call.
|
|
Collect(dest *[]Exemplar)
|
|
}
|