Documentation
¶
Overview ¶
Package variant provides some (well, at the time of this writing) useful implementations of the expvar.Var interface (which is just a Stringer).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SimpleMovingStat ¶
type SimpleMovingStat struct {
// contains filtered or unexported fields
}
represents a size bounded simple moving average it is thread/goroutine safe
func NewSimpleMovingAverage ¶
func NewSimpleMovingAverage(name string, size int) *SimpleMovingStat
Create a new simple moving average expvar.Var. It will be published under `name` and maintain `size` values for calculating the average.
An empty name will cause it to not be published
func NewSimpleMovingMedian ¶
func NewSimpleMovingMedian(name string, size int) *SimpleMovingStat
Create a new simple moving median expvar.Var. It will be published under `name` and maintain `size` values for calculating the median.
An empty name will cause it to not be published ¶
This is just a convenience helper for a SimpleMovingPercentile
func NewSimpleMovingPercentile ¶
func NewSimpleMovingPercentile(name string, percentile float64, size int) *SimpleMovingStat
Create a new simple moving percentile expvar.Var. It will be published under `name` and maintain `size` values for calculating the percentile.
percentile must be between 0 and 1
An empty name will cause it to not be published
func (*SimpleMovingStat) String ¶
func (s *SimpleMovingStat) String() string
display the value as a string
func (*SimpleMovingStat) Update ¶
func (s *SimpleMovingStat) Update(val float64)
Append a new value to the stat
func (*SimpleMovingStat) Value ¶
func (s *SimpleMovingStat) Value() float64
obtain the current value