counter

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: 4 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 counter events.

func New

func New() *Aggregator

New returns a new counter aggregator implemented by atomic operations. This aggregator implements the aggregator.Sum export interface.

func (*Aggregator) Checkpoint added in v0.1.1

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

Checkpoint atomically saves the current value and resets the current sum to zero.

func (*Aggregator) Merge

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

Merge combines two counters by adding their sums.

func (*Aggregator) Sum added in v0.1.1

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

Sum returns the last-checkpointed sum. This will never return an error.

func (*Aggregator) Update

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

Update atomically adds to the current value.

Jump to

Keyboard shortcuts

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