package aggregate

import "go.opentelemetry.io/otel/sdk/metric/internal/aggregate"

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

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
}

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.

Source Files

aggregate.go doc.go exponential_histogram.go histogram.go lastvalue.go sum.go

Version
v1.21.0
Published
Nov 16, 2023
Platform
linux/amd64
Imports
9 packages
Last checked
7 hours ago

Tools for package owners.