stats

package
Version: v0.0.0-...-a873046 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package stats provides collections of counters. Each counter belongs to a snapshottable collection, and these collections can be aggregated.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Int

type Int struct {
	// contains filtered or unexported fields
}

An Int is a integer counter. Ints can be atomically incremented and set.

func (*Int) Add

func (v *Int) Add(delta int64)

Add increments v by delta.

func (*Int) Get

func (v *Int) Get() int64

Get returns the current value of a counter.

func (*Int) Set

func (v *Int) Set(val int64)

Set sets the counter's value to val.

type Map

type Map struct {
	// contains filtered or unexported fields
}

A Map is a set of counters keyed by name.

func NewMap

func NewMap() *Map

NewMap returns a fresh Map.

func (*Map) AddAll

func (m *Map) AddAll(vals Values)

AddAll adds all counters in the map to the provided snapshot.

func (*Map) Int

func (m *Map) Int(name string) *Int

Int returns the counter with the provided name. The counter is created if it does not already exist.

type Values

type Values map[string]int64

Values is a snapshot of the values in a collection.

func (Values) Copy

func (v Values) Copy() Values

Copy returns a copy of the values v.

func (Values) String

func (v Values) String() string

String returns an abbreviated string with the values in this snapshot sorted by key.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto