package lastvalue

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

Index

Types

type Aggregator

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

Aggregator aggregates lastValue events.

func New

func New(cnt int) []Aggregator

New returns a new lastValue aggregator. This aggregator retains the last value and timestamp that were recorded.

func (*Aggregator) Aggregation

func (g *Aggregator) Aggregation() aggregation.Aggregation

Aggregation returns an interface for reading the state of this aggregator.

func (*Aggregator) Kind

func (g *Aggregator) Kind() aggregation.Kind

Kind returns aggregation.LastValueKind.

func (*Aggregator) LastValue

func (g *Aggregator) LastValue() (metric.Number, time.Time, error)

LastValue returns the last-recorded lastValue value and the corresponding timestamp. The error value aggregation.ErrNoData will be returned if (due to a race condition) the checkpoint was computed before the first value was set.

func (*Aggregator) Merge

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

Merge combines state from two aggregators. The most-recently set value is chosen.

func (*Aggregator) SynchronizedMove

func (g *Aggregator) SynchronizedMove(oa export.Aggregator, _ *metric.Descriptor) error

SynchronizedMove atomically saves the current value.

func (*Aggregator) Update

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

Update atomically sets the current "last" value.

Source Files

lastvalue.go

Version
v0.13.0
Published
Oct 8, 2020
Platform
linux/amd64
Imports
8 packages
Last checked
7 minutes ago

Tools for package owners.