timeseries

package
v0.149.1 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LongFrameVersionLatest = LongFrameVersions()[len(LongFrameVersions())-1]
View Source
var MultiFrameVersionLatest = MultiFrameVersions()[len(MultiFrameVersions())-1]
View Source
var WideFrameVersionLatest = WideFrameVersions()[len(WideFrameVersions())-1]

Functions

func LongFrameVersions added in v0.148.0

func LongFrameVersions() []data.FrameTypeVersion

func MultiFrameVersions added in v0.148.0

func MultiFrameVersions() []data.FrameTypeVersion

func WideFrameVersions added in v0.148.0

func WideFrameVersions() []data.FrameTypeVersion

Types

type Collection added in v0.148.0

type Collection struct {
	Refs             []MetricRef
	RemainderIndices []sdata.FrameFieldIndex
	Warning          error
}

type CollectionReader

type CollectionReader interface {
	// GetCollection runs validate without validateData. If the data is valid, then
	// []TimeSeriesMetricRef is returned from reading as well as any ignored data. If invalid,
	// then an error is returned, and no refs or ignoredFieldIndices are returned.
	GetCollection(validateData bool) (Collection, error)

	Frames() []*data.Frame // returns underlying frames
}

func CollectionReaderFromFrames

func CollectionReaderFromFrames(frames []*data.Frame) (CollectionReader, error)

type LongFrame

type LongFrame []*data.Frame

LongFrame is a time series format where all series live in one frame. This time series format should be used with Table-like sources (e.g. SQL) that do not have a native concept of Labels.

func NewLongFrame

func NewLongFrame(v data.FrameTypeVersion) (*LongFrame, error)

func (*LongFrame) Frames

func (ls *LongFrame) Frames() []*data.Frame

func (*LongFrame) GetCollection added in v0.148.0

func (ls *LongFrame) GetCollection(validateData bool) (Collection, error)

type MetricRef

type MetricRef struct {
	TimeField  *data.Field
	ValueField *data.Field
}

MetricRef is for reading and contains the data for an individual time series. In the cases of the Multi and Wide formats, the Fields are pointers to the data in the original frame. In the case of Long new fields are constructed.

func (MetricRef) GetLabels

func (m MetricRef) GetLabels() data.Labels

func (MetricRef) GetMetricName

func (m MetricRef) GetMetricName() string

func (MetricRef) Len added in v0.148.0

func (m MetricRef) Len() (int, error)

func (MetricRef) NullableFloat64Point added in v0.148.0

func (m MetricRef) NullableFloat64Point(pointIdx int) (time.Time, *float64, error)

NullableFloat64Point returns the time and *float64 value at the specified index. It will error if the index is out of bounds, or if the value can not be converted to a *float64.

func (MetricRef) NullableFloat64Value added in v0.148.0

func (m MetricRef) NullableFloat64Value(pointIdx int) (*float64, error)

func (MetricRef) Time added in v0.148.0

func (m MetricRef) Time(pointIdx int) (time.Time, error)

type MultiFrame

type MultiFrame []*data.Frame

MultiFrame is a time series format where each series lives in its own single frame. This time series format should be use for data that natively uses Labels and when all of the series are not guaranteed to have identical time values.

func NewMultiFrame

func NewMultiFrame(v data.FrameTypeVersion) (*MultiFrame, error)

NewMultiFrame creates an empty MultiFrame formatted time series. This function must be called before the AddSeries Method. The returned MultiFrame is a valid typed data response that corresponds to "No Data".

func (*MultiFrame) AddSeries

func (mfs *MultiFrame) AddSeries(metricName string, l data.Labels, t []time.Time, values interface{}) error

values must be a numeric slice such as []int64, []float64, []*float64, etc or []bool / []*bool.

func (*MultiFrame) Frames

func (mfs *MultiFrame) Frames() []*data.Frame

func (*MultiFrame) GetCollection added in v0.148.0

func (mfs *MultiFrame) GetCollection(validateData bool) (Collection, error)

func (*MultiFrame) SetMetricMD

func (mfs *MultiFrame) SetMetricMD(metricName string, l data.Labels, fc data.FieldConfig)

type WideFrame

type WideFrame []*data.Frame

WideFrame is a time series format where all the series live in one frame. This time series format should be use for data that natively uses Labels and when all of the series are guaranteed to have identical time values.

func NewWideFrame

func NewWideFrame(v data.FrameTypeVersion) (*WideFrame, error)

func (*WideFrame) AddSeries

func (wf *WideFrame) AddSeries(metricName string, l data.Labels, values interface{}) error

func (*WideFrame) Frames

func (wf *WideFrame) Frames() []*data.Frame

func (*WideFrame) GetCollection added in v0.148.0

func (wf *WideFrame) GetCollection(validateData bool) (Collection, error)

func (*WideFrame) SetMetricMD

func (wf *WideFrame) SetMetricMD(metricName string, l data.Labels, fc data.FieldConfig)

func (*WideFrame) SetTime

func (wf *WideFrame) SetTime(timeName string, t []time.Time) error

Jump to

Keyboard shortcuts

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