gauge

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2020 License: Apache-2.0 Imports: 7 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 gauge events.

func New

func New() *Aggregator

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

func (*Aggregator) Checkpoint added in v0.1.1

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

Checkpoint atomically saves the current value.

func (*Aggregator) LastValue added in v0.1.1

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

LastValue returns the last-recorded gauge value and the corresponding timestamp. The error value aggregator.ErrNoLastValue 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 *export.Descriptor) error

Merge combines state from two aggregators. If the gauge is declared as monotonic, the greater value is chosen. If the gauge is declared as non-monotonic, the most-recently set value is chosen.

func (*Aggregator) Update

func (g *Aggregator) Update(_ context.Context, number core.Number, desc *export.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