gotosocial/vendor/go.opentelemetry.io/otel/sdk/metric/internal/exemplar/reservoir.go

33 lines
1 KiB
Go
Raw Normal View History

// Copyright The OpenTelemetry Authors
2024-08-26 16:05:54 +00:00
// SPDX-License-Identifier: Apache-2.0
package exemplar // import "go.opentelemetry.io/otel/sdk/metric/internal/exemplar"
import (
"context"
"time"
"go.opentelemetry.io/otel/attribute"
)
// Reservoir holds the sampled exemplar of measurements made.
2024-08-26 16:05:54 +00:00
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.
2024-08-26 16:05:54 +00:00
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.
2024-08-26 16:05:54 +00:00
Collect(dest *[]Exemplar)
}