statstore

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: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StatStore

type StatStore struct {

	// A RWMutex guards all operations on the StatStore.
	sync.RWMutex
	// contains filtered or unexported fields
}

StatStore is a TimeStore-like object that does not implement the TimeStore interface.

func NewStatStore

func NewStatStore(epsilon uint64, resolution time.Duration, windowDuration uint, supportedPercentiles []float64) *StatStore

func (*StatStore) Average

func (ss *StatStore) Average() (uint64, error)

Average returns a weighted average across all buckets, using the count of - resolutions at each bucket as the weight.

func (*StatStore) Get

func (ss *StatStore) Get(start, end time.Time) []TimePoint

Get generates a []TimePoint from the appropriate tpEntries. Get receives a start and end time as parameters. If start or end are equal to time.Time{}, then we consider no such bound.

func (*StatStore) IsEmpty

func (ss *StatStore) IsEmpty() bool

IsEmpty returns true if the StatStore is empty

func (*StatStore) Last

func (ss *StatStore) Last() (TimePoint, uint64, error)

Last returns the latest TimePoint, representing the average value of lastPut. Last also returns the max value of all Puts represented in lastPut. Last returns an error if no Put operations have been performed on the StatStore.

func (*StatStore) Max

func (ss *StatStore) Max() (uint64, error)

Max returns the maximum element currently in the StatStore. Max does NOT consider the case where the maximum is in the last one minute.

func (*StatStore) MaxSize

func (ss *StatStore) MaxSize() time.Duration

MaxSize returns the total duration of data that can be stored in the StatStore.

func (*StatStore) Percentile

func (ss *StatStore) Percentile(p float64) (uint64, error)

Percentile returns the requested percentile from the StatStore.

func (*StatStore) Put

func (ss *StatStore) Put(tp TimePoint) error

type TimePoint

type TimePoint struct {
	Timestamp time.Time
	Value     uint64
}

TimePoint is a single point of a timeseries, representing a time-value pair.

Jump to

Keyboard shortcuts

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