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



    This section is empty.


    This section is empty.


    This section is empty.


    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