Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DurationRatioStat ¶
type DurationRatioStat struct {
// contains filtered or unexported fields
}
DurationRatioStat is an object capable of computing a duration ratio stat properly
func NewDurationRatioStat ¶
func NewDurationRatioStat() *DurationRatioStat
NewDurationRatioStat creates a new duration ratio stat
func (*DurationRatioStat) Add ¶
func (s *DurationRatioStat) Add(k interface{})
Add starts recording a new duration
func (*DurationRatioStat) Done ¶
func (s *DurationRatioStat) Done(k interface{})
Done indicates the duration is now done
func (*DurationRatioStat) Start ¶
func (s *DurationRatioStat) Start()
Start implements the StatHandler interface
func (*DurationRatioStat) Stop ¶
func (s *DurationRatioStat) Stop()
Stop implements the StatHandler interface
func (*DurationRatioStat) Value ¶
func (s *DurationRatioStat) Value(delta time.Duration) (o interface{})
Value implements the StatHandler interface
type IncrementStat ¶
type IncrementStat struct {
// contains filtered or unexported fields
}
IncrementStat is an object capable of computing an increment stat properly
func NewIncrementStat ¶
func NewIncrementStat() *IncrementStat
NewIncrementStat creates a new increment stat
func (*IncrementStat) Start ¶
func (s *IncrementStat) Start()
Start implements the StatHandler interface
func (*IncrementStat) Stop ¶
func (s *IncrementStat) Stop()
Stop implements the StatHandler interface
func (*IncrementStat) Value ¶
func (s *IncrementStat) Value(delta time.Duration) interface{}
Value implements the StatHandler interface
type StatHandler ¶
StatHandler represents a stat handler
type StatHandlerWithoutStart ¶
StatHandlerWithoutStart represents a stat handler that doesn't have to start or stop
func (StatHandlerWithoutStart) Start ¶
func (h StatHandlerWithoutStart) Start()
Start implements the StatHandler interface
func (StatHandlerWithoutStart) Stop ¶
func (h StatHandlerWithoutStart) Stop()
Stop implements the StatHandler interface
func (StatHandlerWithoutStart) Value ¶
func (h StatHandlerWithoutStart) Value(delta time.Duration) interface{}
Value implements the StatHandler interface
type StatMetadata ¶
StatMetadata represents a stat metadata
type Stater ¶
type Stater struct {
// contains filtered or unexported fields
}
Stater is an object that can compute and handle stats
func NewStater ¶
func NewStater(period time.Duration, fn StatsHandleFunc) *Stater
NewStater creates a new stater
func (*Stater) AddStat ¶
func (s *Stater) AddStat(m StatMetadata, h StatHandler)
AddStat adds a stat
func (*Stater) StatsMetadata ¶
func (s *Stater) StatsMetadata() (ms []StatMetadata)
StatsMetadata returns the stats metadata
type StatsHandleFunc ¶
type StatsHandleFunc func(stats []Stat)
StatsHandleFunc is a method that can handle stats