point

package
v0.13.4 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2022 License: MIT Imports: 3 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPointsUnsorted = fmt.Errorf("the points are unsorted")

ErrPointsUnsorted returns for unsorted []Point or Points

View Source
var ErrTimeGreaterStop = fmt.Errorf("the points for time interval are rover")

ErrTimeGreaterStop shows the correct over for GetValueOrNaN

View Source
var ErrWrongMetricID = fmt.Errorf("the point MetricID is wrong")

ErrWrongMetricID shows the Point.MetricID is wrong somehow

Functions

This section is empty.

Types

type GetValueOrNaN added in v0.13.0

type GetValueOrNaN func() (float64, error)

GetValueOrNaN returns Value for the next point or NaN if the value is omited. ErrTimeGreaterStop shows the normal ending. Any else error is considered as real error

func FillNulls added in v0.13.0

func FillNulls(points []Point, from, until, step uint32) (start, stop, count uint32, getter GetValueOrNaN)

FillNulls accepts an ordered []Point for one metric and returns a generator that will return all points for specific interval. Generator returns EmptyPoint when it's finished

type NextMetric added in v0.13.0

type NextMetric func() []Point

NextMetric returns the list of points for one metric name

type Point

type Point struct {
	MetricID  uint32
	Value     float64
	Time      uint32
	Timestamp uint32 // keep max if metric and time equal on two points
}

func CleanUp

func CleanUp(points []Point) []Point

CleanUp removes points with empty metric for run after Deduplicate, Merge, etc for result cleanup

func Uniq

func Uniq(points []Point) []Point

Uniq removes points with equal metric and time

type Points added in v0.6.2

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

Points is a structure that stores points and additional information about them, e.g. steps, aggregating functions and names.

func NewPoints added in v0.6.2

func NewPoints() *Points

NewPoints return new empty Points

func (*Points) AppendPoint added in v0.6.2

func (pp *Points) AppendPoint(metricID uint32, value float64, time uint32, version uint32)

AppendPoint creates a Point with given values and appends it to list

func (*Points) GetAggregation added in v0.13.0

func (pp *Points) GetAggregation(id uint32) (string, error)

GetAggregation returns string function for given metric id.

func (*Points) GetStep added in v0.12.0

func (pp *Points) GetStep(id uint32) (uint32, error)

GetStep returns uint32 step for given metric id.

func (*Points) GroupByMetric added in v0.13.0

func (pp *Points) GroupByMetric() NextMetric

GroupByMetric returns NextMetric function, that by each call returns points for one next metric. It should be called only on sorted and cleaned Points.

func (*Points) Len added in v0.6.2

func (pp *Points) Len() int

func (*Points) Less added in v0.6.2

func (pp *Points) Less(i, j int) bool

func (*Points) List added in v0.6.2

func (pp *Points) List() []Point

List returns list of points

func (*Points) MetricID added in v0.6.2

func (pp *Points) MetricID(metricName string) uint32

MetricID checks if metric name already exists and returns the ID for it. If not, it creates it first.

func (*Points) MetricIDBytes added in v0.11.6

func (pp *Points) MetricIDBytes(metricNameBytes []byte) uint32

MetricIDBytes checks if metric name already exists and returns the ID for it. If not, it creates it first.

func (*Points) MetricName added in v0.6.2

func (pp *Points) MetricName(metricID uint32) string

MetricName returns name for metric with given metricID or empty string when ID does not exist

func (*Points) ReplaceList added in v0.12.0

func (pp *Points) ReplaceList(list []Point)

ReplaceList replaces list of points

func (*Points) SetAggregations added in v0.13.0

func (pp *Points) SetAggregations(functions map[string][]string)

SetAggregations accepts map of metric name as keys and function as values and sets slice of functions for existing metrics in Data.Points

func (*Points) SetSteps added in v0.12.0

func (pp *Points) SetSteps(steps map[uint32][]string)

SetSteps accepts map of metric name as keys and step as values and sets slice of uint32 steps for existing metrics in Data.Points

func (*Points) Sort added in v0.6.2

func (pp *Points) Sort()

Sort sorts the points list by ID, Time

func (*Points) Swap added in v0.6.2

func (pp *Points) Swap(i, j int)

func (*Points) Uniq added in v0.6.2

func (pp *Points) Uniq()

Uniq cleans up the points

Jump to

Keyboard shortcuts

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