timeseries

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 5 Imported by: 6

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

func LongFrameVersions() []data.FrameTypeVersion

func MultiFrameVersions

func MultiFrameVersions() []data.FrameTypeVersion

func WideFrameVersions

func WideFrameVersions() []data.FrameTypeVersion

Types

type Collection

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

func (Collection) NoData added in v0.0.5

func (c Collection) NoData() bool

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.Frames // 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(refID string, v data.FrameTypeVersion) (*LongFrame, error)

func (*LongFrame) Frames

func (ls *LongFrame) Frames() data.Frames

func (*LongFrame) GetCollection

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

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

func (MetricRef) NullableFloat64Point

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

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

func (MetricRef) Time

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 LongToMulti added in v0.0.7

func LongToMulti(longFrame *LongFrame) (*MultiFrame, error)

LongToMulti converts a LongFrame into a MultiFrame and returns an error if it fails to parse the LongFrame.

func NewMultiFrame

func NewMultiFrame(refID string, 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.Frames

func (*MultiFrame) GetCollection

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(refID string, v data.FrameTypeVersion) (*WideFrame, error)

func (*WideFrame) AddSeries

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

func (*WideFrame) Frames

func (wf *WideFrame) Frames() data.Frames

func (*WideFrame) GetCollection

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