daystore

package
v0.18.4 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2016 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DayStore

type DayStore struct {
	// a RWMutex guards all operations on the underlying window and cached values.
	sync.RWMutex

	// Hour is a StatStore with data from the last one hour
	Hour *statstore.StatStore
	// contains filtered or unexported fields
}

Note on how derived stats are extracted: If the DayStore holds less than 1 hour of data, then the average, max and 95th are - calculated only from the the Hour store.

If the DayStore holds more than 1 hour of data, then the average and 95th are calculated - only from the 24 past hourly stats that have been collected. Assuming a resolution of 1 minute, this behavior may ignore up to 59 minutes of the latest data. This behavior is required to avoid calculating less than a full day's data. In order to correctly capture spikes, the Max takes into account the latest data, causing the - max to reflect values in the past [24 hours, 25 hours)

func NewDayStore

func NewDayStore(epsilon uint64, resolution time.Duration) *DayStore

NewDayStore is a DayStore constructor. The recommended minimum resolution is at least one minute.

func (*DayStore) Average

func (ds *DayStore) Average() (uint64, error)

Average returns the average value of the hourly averages in the past day.

func (*DayStore) Max

func (ds *DayStore) Max() (uint64, error)

Max returns the maximum value of the hourly maxes in the past day.

func (*DayStore) NinetyFifth

func (ds *DayStore) NinetyFifth() (uint64, error)

NinetyFifth returns the 95th percentile of the hourly 95th percentiles in the past day.

func (*DayStore) Put

func (ds *DayStore) Put(tp statstore.TimePoint) error

Put stores a TimePoint into the Hour StatStore, while checking whether it - is time to flush the last hour's stats in the window. Put operations need to be performed in a chronological (time-ascending) order

Jump to

Keyboard shortcuts

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