Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Counter ¶
Counter is a simple counter
type Metrics ¶
type Metrics struct { Timers map[string]*Timer Counters map[string]*Counter MultiCounters map[string]*MultiCounter sync.RWMutex // contains filtered or unexported fields }
Metrics is the main object to instantiate when using the metrics package. One instance of a Metrics object will contain all your timers and counters and results
func NewMetrics ¶
func NewMetrics() Metrics
func (*Metrics) MarshalResults ¶
func (*Metrics) SetResults ¶
type MultiCounter ¶
type MultiCounter struct { Name string Counters map[string]*Counter sync.RWMutex // contains filtered or unexported fields }
MultiCounter is a collection of counters. Useful for making comparisons between groups of similar statistics
func (*MultiCounter) Get ¶
func (self *MultiCounter) Get(counter string) (c *Counter)
func (*MultiCounter) Increment ¶
func (self *MultiCounter) Increment(counter string)
Increment increments specific counter by 1
func (*MultiCounter) Reset ¶
func (self *MultiCounter) Reset(counter string)
Reset resets specific counter
func (*MultiCounter) Update ¶
func (self *MultiCounter) Update(f func(k string, v interface{}))
Update is called to save the values of all counters into the results map. You can pass any map[string]Interface{} to store results including the provide Results map on the main Metrics struct
type Timer ¶
type Timer struct { Name string BufferSize uint64 sync.RWMutex // contains filtered or unexported fields }
Timer is a simple timer used to measure time taken to perform given tasks in microseconds