bigslice: Index | Files

package stats

import ""

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


Package Files


type Int Uses

type Int struct {
    // contains filtered or unexported fields

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

func (*Int) Add Uses

func (v *Int) Add(delta int64)

Add increments v by delta.

func (*Int) Get Uses

func (v *Int) Get() int64

Get returns the current value of a counter.

func (*Int) Set Uses

func (v *Int) Set(val int64)

Set sets the counter's value to val.

type Map Uses

type Map struct {
    // contains filtered or unexported fields

A Map is a set of counters keyed by name.

func NewMap Uses

func NewMap() *Map

NewMap returns a fresh Map.

func (*Map) AddAll Uses

func (m *Map) AddAll(vals Values)

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

func (*Map) Int Uses

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 Uses

type Values map[string]int64

Values is a snapshot of the values in a collection.

func (Values) Copy Uses

func (v Values) Copy() Values

Copy returns a copy of the values v.

func (Values) String Uses

func (v Values) String() string

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

Package stats imports 5 packages (graph) and is imported by 1 packages. Updated 2019-10-02. Refresh now. Tools for package owners.