aggregate

package
v1.33.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package aggregate provides aggregate types used compute aggregations and cycle the state of metric measurements made by the SDK. These types and functionality are meant only for internal SDK use.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder[N int64 | float64] struct {
	// Temporality is the temporality used for the returned aggregate function.
	//
	// If this is not provided a default of cumulative will be used (except for
	// the last-value aggregate function where delta is the only appropriate
	// temporality).
	Temporality metricdata.Temporality
	// Filter is the attribute filter the aggregate function will use on the
	// input of measurements.
	Filter attribute.Filter
	// ReservoirFunc is the factory function used by aggregate functions to
	// create new exemplar reservoirs for a new seen attribute set.
	//
	// If this is not provided a default factory function that returns an
	// dropReservoir reservoir will be used.
	ReservoirFunc func(attribute.Set) FilteredExemplarReservoir[N]
	// AggregationLimit is the cardinality limit of measurement attributes. Any
	// measurement for new attributes once the limit has been reached will be
	// aggregated into a single aggregate for the "otel.metric.overflow"
	// attribute.
	//
	// If AggregationLimit is less than or equal to zero there will not be an
	// aggregation limit imposed (i.e. unlimited attribute sets).
	AggregationLimit int
}

Builder builds an aggregate function.

func (Builder[N]) ExplicitBucketHistogram

func (b Builder[N]) ExplicitBucketHistogram(boundaries []float64, noMinMax, noSum bool) (Measure[N], ComputeAggregation)

ExplicitBucketHistogram returns a histogram aggregate function input and output.

func (Builder[N]) ExponentialBucketHistogram

func (b Builder[N]) ExponentialBucketHistogram(maxSize, maxScale int32, noMinMax, noSum bool) (Measure[N], ComputeAggregation)

ExponentialBucketHistogram returns a histogram aggregate function input and output.

func (Builder[N]) LastValue

func (b Builder[N]) LastValue() (Measure[N], ComputeAggregation)

LastValue returns a last-value aggregate function input and output.

func (Builder[N]) PrecomputedLastValue added in v1.27.0

func (b Builder[N]) PrecomputedLastValue() (Measure[N], ComputeAggregation)

PrecomputedLastValue returns a last-value aggregate function input and output. The aggregation returned from the returned ComputeAggregation function will always only return values from the previous collection cycle.

func (Builder[N]) PrecomputedSum

func (b Builder[N]) PrecomputedSum(monotonic bool) (Measure[N], ComputeAggregation)

PrecomputedSum returns a sum aggregate function input and output. The arguments passed to the input are expected to be the precomputed sum values.

func (Builder[N]) Sum

func (b Builder[N]) Sum(monotonic bool) (Measure[N], ComputeAggregation)

Sum returns a sum aggregate function input and output.

type ComputeAggregation

type ComputeAggregation func(dest *metricdata.Aggregation) int

ComputeAggregation stores the aggregate of measurements into dest and returns the number of aggregate data-points output.

type FilteredExemplarReservoir added in v1.31.0

type FilteredExemplarReservoir[N int64 | float64] interface {
	// Offer accepts the parameters associated with a measurement. The
	// parameters will be stored as an exemplar if the filter 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.
	Offer(ctx context.Context, val N, attr []attribute.KeyValue)
	// Collect returns all the held exemplars in the reservoir.
	Collect(dest *[]exemplar.Exemplar)
}

FilteredExemplarReservoir wraps a exemplar.Reservoir with a filter.

func NewFilteredExemplarReservoir added in v1.31.0

func NewFilteredExemplarReservoir[N int64 | float64](f exemplar.Filter, r exemplar.Reservoir) FilteredExemplarReservoir[N]

NewFilteredExemplarReservoir creates a FilteredExemplarReservoir which only offers values that are allowed by the filter.

type Measure

type Measure[N int64 | float64] func(context.Context, N, attribute.Set)

Measure receives measurements to be aggregated.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL