lastvalue

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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() (number.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 number.Number, desc *metric.Descriptor) error

Update atomically sets the current "last" value.

Jump to

Keyboard shortcuts

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