package sum

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

Index

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

func (c *Aggregator) Checkpoint(ctx context.Context, _ *metric.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 *metric.Descriptor) error

Merge combines two counters by adding their sums.

func (*Aggregator) Sum

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 *metric.Descriptor) error

Update atomically adds to the current value.

Source Files

sum.go

Version
v0.4.3
Published
Apr 24, 2020
Platform
linux/amd64
Imports
5 packages
Last checked
1 minute ago

Tools for package owners.