ts

package
v0.0.0-...-9741fed Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Memset

func Memset(data []float64, value float64)

Memset is a faster way to initialize a float64 array.

BenchmarkMemsetZeroValues-4 1000000 1344 ns/op 0 B/op 0 allocs/op BenchmarkLoopZeroValues-4 500000 3217 ns/op 0 B/op 0 allocs/op BenchmarkMemsetNonZeroValues-4 1000000 1537 ns/op 0 B/op 0 allocs/op BenchmarkLoopNonZeroValues-4 500000 3236 ns/op 0 B/op 0 allocs/op *

Types

type Datapoint

type Datapoint struct {
	Timestamp time.Time
	Value     float64
}

A Datapoint is a single data value reported at a given time

func (*Datapoint) ValueIsNaN

func (d *Datapoint) ValueIsNaN() bool

ValueIsNaN returns true iff underlying value is NaN

type Datapoints

type Datapoints []*Datapoint

Datapoints is a list of datapoints.

func (Datapoints) AllNaN

func (d Datapoints) AllNaN() bool

AllNaN returns true if all the values are NaN

func (Datapoints) Len

func (d Datapoints) Len() int

Len is the length of the array.

func (Datapoints) ValueAt

func (d Datapoints) ValueAt(n int) float64

ValueAt returns the value at the nth element.

type MutableValues

type MutableValues interface {
	Values

	// Resets the values
	Reset()

	// Sets the value at the given entry
	SetValueAt(n int, v float64)
}

MutableValues is the interface for values that can be updated

func NewValues

func NewValues(ctx context.Context, millisPerStep, numSteps int) MutableValues

NewValues returns MutableValues supporting the given number of values at the requested granularity. The values start off as NaN

type Series

type Series struct {

	// The Specification is the path that was used to generate this timeseries,
	// typically either the query, or the function stack used to transform
	// specific results.
	Specification string

	// Metric tags.
	Tags models.Tags
	// contains filtered or unexported fields
}

A Series is the public interface to a block of timeseries values. Each block has a start time, a logical number of steps, and a step size indicating the number of milliseconds represented by each point.

func NewSeries

func NewSeries(ctx context.Context, name string, startTime time.Time, vals Values, tags models.Tags) *Series

NewSeries creates a new Series at a given start time, backed by the provided values

func (*Series) Len

func (b *Series) Len() int

Len returns the number of values in the time series. Used for aggregation

func (*Series) MillisPerStep

func (b *Series) MillisPerStep() int

MillisPerStep returns the step size for the vals

func (*Series) Name

func (b *Series) Name() string

Name returns the name of the timeseries block

func (*Series) StartTime

func (b *Series) StartTime() time.Time

StartTime returns the time the block starts

func (*Series) StartTimeForStep

func (b *Series) StartTimeForStep(n int) time.Time

StartTimeForStep returns the time at which the given step starts

func (*Series) ValueAt

func (b *Series) ValueAt(i int) float64

ValueAt returns the value at a given step. Used for aggregation

type Values

type Values interface {
	// Len returns the number of values present
	Len() int

	// ValueAt returns the value at the nth element
	ValueAt(n int) float64

	// The number of millisseconds represented by each index
	MillisPerStep() int

	// Slice of data values in a range
	Slice(begin, end int) Values

	// AllNaN returns true if the values are all NaN
	AllNaN() bool
}

Values holds the values for a timeseries. It provides a minimal interface for storing and retrieving values in the series, with Series providing a more convenient interface for applications to build on top of. Values objects are not specific to a given time, allowing them to be pre-allocated, pooled, and re-used across multiple Series. There are multiple implementations of Values so that we can optimize storage based on the density of the series.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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