Documentation ¶
Overview ¶
Package flapper contains simple mechanism / counter for tracking state changes and detecting potential 'flapping'
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Flapper ¶
type Flapper struct {
// contains filtered or unexported fields
}
Flapper is a simple struct for watching for services that are in a flapState
func NewFlapper ¶
NewFlapper - Create a new instance of Flapper
func (*Flapper) Compact ¶
func (f *Flapper) Compact()
Compact - If a Flapper has been running for a long time, you may want to periodically clean up any services that do not have any data. Compaction allows us to compress our internal data-structures and potentially free up memory.
func (*Flapper) IsFlapping ¶
IsFlapping - Return boolean indicating whether or not the state is flapping or not. Note that if the state does not exist we always return false sine we lazily create counters.
service - the service to check against recompute - bool flag to recompute the time-window if it has not been updated in a while
func (*Flapper) NoteStateChange ¶
NoteStateChange - Increment the counter for a service (or create a counter for the service if one has not alredy been created). (Lazily create services).