aggregate

package
v1.26.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 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
	// exemplar.Drop reservoir will be used.
	ReservoirFunc func() exemplar.Reservoir[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.

The Builder.Temporality is ignored and delta is use always.

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 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