package histogram

import "go.opentelemetry.io/otel/sdk/metric/aggregator/histogram"

Index

Types

type Aggregator

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

Aggregator observe events and counts them in pre-determined buckets. It also calculates the sum and count of all events.

func New

func New(desc *metric.Descriptor, boundaries []metric.Number) *Aggregator

New returns a new measure aggregator for computing Histograms.

A Histogram observe events and counts them in pre-defined buckets. And also provides the total sum and count of all observations.

Note that this aggregator maintains each value using independent atomic operations, which introduces the possibility that checkpoints are inconsistent.

func (*Aggregator) Checkpoint

func (c *Aggregator) Checkpoint(ctx context.Context, desc *metric.Descriptor)

Checkpoint saves the current state and resets the current state to the empty set. Since no locks are taken, there is a chance that the independent Sum, Count and Bucket Count are not consistent with each other.

func (*Aggregator) Count

func (c *Aggregator) Count() (int64, error)

Count returns the number of values in the checkpoint.

func (*Aggregator) Histogram

func (c *Aggregator) Histogram() (aggregator.Buckets, error)

Histogram returns the count of events in pre-determined buckets.

func (*Aggregator) Merge

func (c *Aggregator) Merge(oa export.Aggregator, desc *metric.Descriptor) error

Merge combines two histograms that have the same buckets into a single one.

func (*Aggregator) Sum

func (c *Aggregator) Sum() (metric.Number, error)

Sum returns the sum of all values in the checkpoint.

func (*Aggregator) Update

func (c *Aggregator) Update(_ context.Context, number metric.Number, desc *metric.Descriptor) error

Update adds the recorded measurement to the current data set.

Source Files

histogram.go

Version
v0.5.0
Published
May 14, 2020
Platform
linux/amd64
Imports
6 packages
Last checked
23 minutes ago

Tools for package owners.