aggregation

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: Apache-2.0 Imports: 6 Imported by: 5 modules, 8 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MaybeReplaceAnnotation added in v1.4.0

func MaybeReplaceAnnotation(currentAnnotation, newAnnotation []byte) []byte

MaybeReplaceAnnotation replaces the current annotation with the new annotation, returning the updated ref for current annotation.

Types

type Counter

type Counter struct {
	Options
	// contains filtered or unexported fields
}

Counter aggregates counter values.

func NewCounter

func NewCounter(opts Options) Counter

NewCounter creates a new counter.

func (*Counter) Annotation added in v1.2.0

func (c *Counter) Annotation() []byte

Annotation returns the annotation associated with the counter.

func (*Counter) Close

func (c *Counter) Close()

Close closes the counter.

func (*Counter) Count

func (c *Counter) Count() int64

Count returns the number of values received.

func (*Counter) LastAt added in v0.15.0

func (c *Counter) LastAt() time.Time

LastAt returns the time of the last value received.

func (*Counter) Max

func (c *Counter) Max() int64

Max returns the maximum counter value.

func (*Counter) Mean

func (c *Counter) Mean() float64

Mean returns the mean counter value.

func (*Counter) Min

func (c *Counter) Min() int64

Min returns the minimum counter value.

func (*Counter) Stdev

func (c *Counter) Stdev() float64

Stdev returns the standard deviation counter value.

func (*Counter) Sum

func (c *Counter) Sum() int64

Sum returns the sum of counter values.

func (*Counter) SumSq

func (c *Counter) SumSq() int64

SumSq returns the squared sum of counter values.

func (*Counter) Update

func (c *Counter) Update(timestamp time.Time, value int64, annotation []byte)

Update updates the counter value.

func (*Counter) ValueOf

func (c *Counter) ValueOf(aggType aggregation.Type) float64

ValueOf returns the value for the aggregation type.

type CounterMetrics added in v0.15.0

type CounterMetrics struct {
	// contains filtered or unexported fields
}

CounterMetrics is a set of counter metrics can be used by all counters.

func (CounterMetrics) IncValuesOutOfOrder added in v0.15.0

func (m CounterMetrics) IncValuesOutOfOrder()

IncValuesOutOfOrder increments value or if not initialized is a no-op.

type Gauge

type Gauge struct {
	Options
	// contains filtered or unexported fields
}

Gauge aggregates gauge values.

func NewGauge

func NewGauge(opts Options) Gauge

NewGauge creates a new gauge.

func (*Gauge) Annotation added in v1.2.0

func (g *Gauge) Annotation() []byte

Annotation returns the annotation associated with the gauge.

func (*Gauge) Close

func (g *Gauge) Close()

Close closes the gauge.

func (*Gauge) Count

func (g *Gauge) Count() int64

Count returns the number of values received.

func (*Gauge) Last

func (g *Gauge) Last() float64

Last returns the last value received.

func (*Gauge) LastAt added in v0.15.0

func (g *Gauge) LastAt() time.Time

LastAt returns the time of the last value received.

func (*Gauge) Max

func (g *Gauge) Max() float64

Max returns the maximum gauge value.

func (*Gauge) Mean

func (g *Gauge) Mean() float64

Mean returns the mean gauge value.

func (*Gauge) Min

func (g *Gauge) Min() float64

Min returns the minimum gauge value.

func (*Gauge) Stdev

func (g *Gauge) Stdev() float64

Stdev returns the standard deviation gauge value.

func (*Gauge) Sum

func (g *Gauge) Sum() float64

Sum returns the sum of gauge values.

func (*Gauge) SumSq

func (g *Gauge) SumSq() float64

SumSq returns the squared sum of gauge values.

func (*Gauge) Update

func (g *Gauge) Update(timestamp time.Time, value float64, annotation []byte)

Update updates the gauge value.

func (*Gauge) UpdatePrevious added in v1.2.0

func (g *Gauge) UpdatePrevious(timestamp time.Time, value float64, prevValue float64)

UpdatePrevious removes the prevValue from the aggregation and updates with the new value.

func (*Gauge) ValueOf

func (g *Gauge) ValueOf(aggType aggregation.Type) float64

ValueOf returns the value for the aggregation type.

type GaugeMetrics added in v0.15.0

type GaugeMetrics struct {
	// contains filtered or unexported fields
}

GaugeMetrics is a set of gauge metrics can be used by all gauges.

func (GaugeMetrics) IncValuesOutOfOrder added in v0.15.0

func (m GaugeMetrics) IncValuesOutOfOrder()

IncValuesOutOfOrder increments value or if not initialized is a no-op.

type Metrics added in v0.15.0

type Metrics struct {
	Counter CounterMetrics
	Gauge   GaugeMetrics
}

Metrics is a set of metrics that can be used by elements.

func NewMetrics added in v0.15.0

func NewMetrics(scope tally.Scope) Metrics

NewMetrics is a set of aggregation metrics.

type Options

type Options struct {
	// Metrics is as set of aggregation metrics.
	Metrics Metrics
	// HasExpensiveAggregations means expensive (multiplication/division)
	// aggregation types are enabled.
	HasExpensiveAggregations bool
}

Options is the options for aggregations.

func NewOptions

func NewOptions(instrumentOpts instrument.Options) Options

NewOptions creates a new aggregation options.

func (*Options) ResetSetData

func (o *Options) ResetSetData(aggTypes aggregation.Types)

ResetSetData resets the aggregation options.

type Timer

type Timer struct {
	// contains filtered or unexported fields
}

Timer aggregates timer values. Timer APIs are not thread-safe.

func NewTimer

func NewTimer(quantiles []float64, streamOpts cm.Options, opts Options) Timer

NewTimer creates a new timer

func (*Timer) Add

func (t *Timer) Add(timestamp time.Time, value float64, annotation []byte)

Add adds a timer value.

func (*Timer) AddBatch

func (t *Timer) AddBatch(timestamp time.Time, values []float64, annotation []byte)

AddBatch adds a batch of timer values.

func (*Timer) Annotation added in v1.2.0

func (t *Timer) Annotation() []byte

Annotation returns the annotation associated with the timer.

func (*Timer) Close

func (t *Timer) Close()

Close closes the timer.

func (*Timer) Count

func (t *Timer) Count() int64

Count returns the number of values received.

func (*Timer) LastAt added in v0.15.0

func (t *Timer) LastAt() time.Time

LastAt returns the time of the last value received.

func (*Timer) Max

func (t *Timer) Max() float64

Max returns the maximum timer value.

func (*Timer) Mean

func (t *Timer) Mean() float64

Mean returns the mean timer value.

func (*Timer) Min

func (t *Timer) Min() float64

Min returns the minimum timer value.

func (*Timer) Quantile

func (t *Timer) Quantile(q float64) float64

Quantile returns the value at a given quantile.

func (*Timer) Stdev

func (t *Timer) Stdev() float64

Stdev returns the standard deviation timer value.

func (*Timer) Sum

func (t *Timer) Sum() float64

Sum returns the sum of timer values.

func (*Timer) SumSq

func (t *Timer) SumSq() float64

SumSq returns the squared sum of timer values.

func (*Timer) ValueOf

func (t *Timer) ValueOf(aggType aggregation.Type) float64

ValueOf returns the value for the aggregation type.

Directories

Path Synopsis
quantile
cm
Package cm implements the Cormode-Muthukrishnan algorithm for computing biased quantiles over data streams from "Effective Computation of Biased Quantiles over Data Streams" and is largely based on statsite's implementation in C: https://github.com/statsite/statsite/blob/master/src/cm_quantile.c
Package cm implements the Cormode-Muthukrishnan algorithm for computing biased quantiles over data streams from "Effective Computation of Biased Quantiles over Data Streams" and is largely based on statsite's implementation in C: https://github.com/statsite/statsite/blob/master/src/cm_quantile.c

Jump to

Keyboard shortcuts

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