stats

package
v2.5.6 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Series

type Series struct {
	// contains filtered or unexported fields
}

Series contains logic of accumulating time series data.

func NewSeries

func NewSeries(d time.Duration, n int) *Series

NewSeries creates time series aggregation with d window size and granularity rate n.

The higher the granulatiry, the more accurate and smooth results will be provided by series.

func (*Series) Add

func (s *Series) Add(now time.Time, x float64)

Add adds given value x at the time moment of now.

func (*Series) Get

func (s *Series) Get(now time.Time) (sum float64, cnt int64)

Get returns accumulated data available at the moment of now.

func (*Series) String

func (s *Series) String() string

func (*Series) SumPer

func (s *Series) SumPer(now time.Time, period time.Duration) float64

SumPer returns rate of accumulated data available at the moment of now.

Jump to

Keyboard shortcuts

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