counters

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2022 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CounterSet

type CounterSet struct {
	Values map[string]uint64 `json:"values"`
	IntId  string            `json:"intId"`
}

CounterSet represents an interface found during counter push The keys to the Values map are the names of individual counters we're tracking for the interface (for instance, the names of MIB variables) and the values are the absolute values of the counters; consumers are usually interested in the deltas.

func NewCounterSet

func NewCounterSet() *CounterSet

func NewCounterSetWithId

func NewCounterSetWithId(id string) *CounterSet

func (*CounterSet) GetDelta

func (cs *CounterSet) GetDelta(counterName string, cur uint64) uint64

Calculate the delta between the previous recorded value (in cs.Values[counterName]) and the current (new) value. Given a nil cs, return 0.

func (*CounterSet) SetValue

func (cs *CounterSet) SetValue(validate map[string]string, oid string, val uint64)

func (*CounterSet) SetValueAndReturnDelta

func (cs *CounterSet) SetValueAndReturnDelta(counterName string, cur uint64) uint64

Calculate the delta, save the current value, and return the delta.

Jump to

Keyboard shortcuts

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