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() *Aggregator

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

func (*Aggregator) Checkpoint

func (g *Aggregator) Checkpoint(ctx context.Context, _ *metric.Descriptor)

Checkpoint atomically saves the current value.

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 aggregator.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) 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.5.0
Published
May 14, 2020
Platform
linux/amd64
Imports
7 packages
Last checked
23 minutes ago

Tools for package owners.