flapper

package
v0.0.0-...-27b2fc9 Latest Latest
Warning

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

Go to latest
Published: May 10, 2017 License: Apache-2.0 Imports: 2 Imported by: 1

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

func NewFlapper(max uint, duration uint) *Flapper

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

func (f *Flapper) IsFlapping(service string, recompute bool) bool

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

func (f *Flapper) NoteStateChange(service string)

NoteStateChange - Increment the counter for a service (or create a counter for the service if one has not alredy been created). (Lazily create services).

Jump to

Keyboard shortcuts

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