Documentation
¶
Overview ¶
Package timeseries defines the interface for managing time seres objects and provides time range manipulation capabilities
Index ¶
- Constants
- Variables
- func ExtentLRUCmp(a, b Extent) int
- type Extent
- func (e Extent) After(t time.Time) bool
- func (z *Extent) DecodeMsg(dc *msgp.Reader) (err error)
- func (z Extent) EncodeMsg(en *msgp.Writer) (err error)
- func (e Extent) EndVal() time.Time
- func (z Extent) MarshalMsg(b []byte) (o []byte, err error)
- func (z Extent) Msgsize() (s int)
- func (e Extent) NewSegment(start, end time.Time) segments.Segment[time.Time]
- func (e Extent) StartVal() time.Time
- func (e Extent) String() string
- func (z *Extent) UnmarshalMsg(bts []byte) (o []byte, err error)
- type ExtentList
- func (el ExtentList) CalculateDeltas(needs ExtentList, step time.Duration) ExtentList
- func (el ExtentList) Clone() ExtentList
- func (el ExtentList) CloneRange(start, end int) ExtentList
- func (el ExtentList) Compress(step time.Duration) ExtentList
- func (el ExtentList) Crop(ex Extent) ExtentList
- func (z *ExtentList) DecodeMsg(dc *msgp.Reader) (err error)
- func (z ExtentList) EncodeMsg(en *msgp.Writer) (err error)
- func (el ExtentList) EncompassedBy(e Extent) bool
- func (el ExtentList) Encompasses(e Extent) bool
- func (el ExtentList) Len() int
- func (el ExtentList) Less(i, j int) bool
- func (z ExtentList) MarshalMsg(b []byte) (o []byte, err error)
- func (el ExtentList) Merge(el2 ExtentList, step time.Duration) ExtentList
- func (z ExtentList) Msgsize() (s int)
- func (el ExtentList) OutsideOf(e Extent) bool
- func (el ExtentList) Remove(r ExtentList, step time.Duration) ExtentList
- func (el ExtentList) Size() int
- func (el ExtentList) Splice(step, maxRange, spliceStep time.Duration, maxPoints int) ExtentList
- func (el ExtentList) String() string
- func (el ExtentList) Swap(i, j int)
- func (el ExtentList) TimestampCount(d time.Duration) int64
- func (z *ExtentList) UnmarshalMsg(bts []byte) (o []byte, err error)
- type ExtentListLRU
- func (el ExtentListLRU) Clone() ExtentListLRU
- func (z *ExtentListLRU) DecodeMsg(dc *msgp.Reader) (err error)
- func (z ExtentListLRU) EncodeMsg(en *msgp.Writer) (err error)
- func (el ExtentListLRU) Len() int
- func (el ExtentListLRU) Less(i, j int) bool
- func (z ExtentListLRU) MarshalMsg(b []byte) (o []byte, err error)
- func (z ExtentListLRU) Msgsize() (s int)
- func (el ExtentListLRU) String() string
- func (el ExtentListLRU) Swap(i, j int)
- func (z *ExtentListLRU) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (el ExtentListLRU) UpdateLastUsed(lur Extent, step time.Duration) ExtentListLRU
- type FieldDataType
- func (z *FieldDataType) DecodeMsg(dc *msgp.Reader) (err error)
- func (z FieldDataType) EncodeMsg(en *msgp.Writer) (err error)
- func (z FieldDataType) MarshalMsg(b []byte) (o []byte, err error)
- func (z FieldDataType) Msgsize() (s int)
- func (z *FieldDataType) UnmarshalMsg(bts []byte) (o []byte, err error)
- type FieldDefinition
- func (z *FieldDefinition) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *FieldDefinition) EncodeMsg(en *msgp.Writer) (err error)
- func (z *FieldDefinition) MarshalMsg(b []byte) (o []byte, err error)
- func (z *FieldDefinition) Msgsize() (s int)
- func (fd FieldDefinition) Size() int
- func (fd FieldDefinition) String() string
- func (z *FieldDefinition) UnmarshalMsg(bts []byte) (o []byte, err error)
- type FieldDefinitionLookup
- func (z *FieldDefinitionLookup) DecodeMsg(dc *msgp.Reader) (err error)
- func (z FieldDefinitionLookup) EncodeMsg(en *msgp.Writer) (err error)
- func (z FieldDefinitionLookup) MarshalMsg(b []byte) (o []byte, err error)
- func (z FieldDefinitionLookup) Msgsize() (s int)
- func (z *FieldDefinitionLookup) UnmarshalMsg(bts []byte) (o []byte, err error)
- type FieldDefinitions
- func (fds FieldDefinitions) Clone() FieldDefinitions
- func (z *FieldDefinitions) DecodeMsg(dc *msgp.Reader) (err error)
- func (z FieldDefinitions) EncodeMsg(en *msgp.Writer) (err error)
- func (z FieldDefinitions) MarshalMsg(b []byte) (o []byte, err error)
- func (z FieldDefinitions) Msgsize() (s int)
- func (fds FieldDefinitions) String() string
- func (fds FieldDefinitions) ToLookup() FieldDefinitionLookup
- func (z *FieldDefinitions) UnmarshalMsg(bts []byte) (o []byte, err error)
- type FieldRole
- type List
- type MarshalWriterFunc
- type MarshalerFunc
- type Modeler
- type RequestOptions
- type SeriesFields
- func (z *SeriesFields) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *SeriesFields) EncodeMsg(en *msgp.Writer) (err error)
- func (z *SeriesFields) MarshalMsg(b []byte) (o []byte, err error)
- func (z *SeriesFields) Msgsize() (s int)
- func (z *SeriesFields) UnmarshalMsg(bts []byte) (o []byte, err error)
- type TimeRangeQuery
- func (trq *TimeRangeQuery) Clone() *TimeRangeQuery
- func (z *TimeRangeQuery) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *TimeRangeQuery) EncodeMsg(en *msgp.Writer) (err error)
- func (trq *TimeRangeQuery) ExtractBackfillTolerance(input string)
- func (trq *TimeRangeQuery) GetBackfillTolerance(def time.Duration, points int) time.Duration
- func (z *TimeRangeQuery) MarshalMsg(b []byte) (o []byte, err error)
- func (z *TimeRangeQuery) Msgsize() (s int)
- func (trq *TimeRangeQuery) NormalizeExtent()
- func (trq *TimeRangeQuery) Size() int
- func (trq *TimeRangeQuery) String() string
- func (z *TimeRangeQuery) UnmarshalMsg(bts []byte) (o []byte, err error)
- type Timeseries
- type UnmarshalerFunc
- type UnmarshalerReaderFunc
Constants ¶
const ( // TimeRangeQueryCtx is a unique Context identifier for Time Range Query information TimeRangeQueryCtx timeSeriesCtxVal = iota // RequestOptionsCtx is a unique Context identifier for Request Options information RequestOptionsCtx )
const BackfillToleranceFlag = "trickster-backfill-tolerance:"
BackfillToleranceFlag is a string that is checked to determine if Backfill Tolerance should be adjusted for the provided query
const FastForwardUserDisableFlag = "trickster-fast-forward:off"
FastForwardUserDisableFlag is a string that is checked to determine if Fast Forward should be selectively disabled for the provided query
const Second = 1000000000
Second is 1B, because 1B Nanoseconds == 1 Second
Variables ¶
var ErrInvalidBody = errors.New("could not deserialize result body")
ErrInvalidBody is an error for when a provided body cannot be deserialized to a DataSet
var ErrInvalidExtent = errors.New("invalid extent")
ErrInvalidExtent is an error for invalid extent (e.g., end is before start)
var ErrInvalidTimeFormat = errors.New("invalid time format")
ErrInvalidTimeFormat is an error for when the provided time is not in the expected format
var ErrNoTimerangeQuery = errors.New("no timerange query")
ErrNoTimerangeQuery is an error for when a method is provided a nil *TimeRangeQuery
var ErrTableHeader = errors.New("could not deserialize table header")
ErrTableHeader is an error for could not deserialize table header
var ErrUnknownFormat = errors.New("unknown timeseries format")
ErrUnknownFormat is an error for when a provided TimeSeries cannot be cast to a DataSet
var ErrUnmarshalEpoch = errors.New("could not convert value to epoch timestamp")
ErrUnmarshalEpoch is an error for invalid epoch timestamp format
Functions ¶
func ExtentLRUCmp ¶ added in v2.0.2
Types ¶
type Extent ¶
type Extent struct {
Start time.Time `msg:"start" json:"start"`
End time.Time `msg:"end" json:"end"`
LastUsed time.Time `msg:"lu" json:"-"`
}
Extent describes the start and end times for a given range of data
func (Extent) After ¶
After returns true if the range of the Extent is completely after the provided time
func (Extent) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
func (Extent) Msgsize ¶
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (Extent) NewSegment ¶
type ExtentList ¶
type ExtentList []Extent
ExtentList is a type of []Extent used for sorting the slice
func (ExtentList) CalculateDeltas ¶
func (el ExtentList) CalculateDeltas(needs ExtentList, step time.Duration, ) ExtentList
CalculateDeltas provides a list of extents that are not in el based on the needed extent. step is used to determine which absolute timestamps in need will be checked in el.
func (ExtentList) Clone ¶
func (el ExtentList) Clone() ExtentList
Clone returns a true copy of the ExtentList
func (ExtentList) CloneRange ¶
func (el ExtentList) CloneRange(start, end int) ExtentList
CloneRange returns a perfect copy of the ExtentList, cloning only the Extents in the provided index range (upper-bound exclusive)
func (ExtentList) Compress ¶
func (el ExtentList) Compress(step time.Duration) ExtentList
Compress sorts an ExtentList and merges time-adjacent Extents so that the total extent of data is accurately represented in as few Extents as possible
func (ExtentList) Crop ¶
func (el ExtentList) Crop(ex Extent) ExtentList
Crop reduces the ExtentList to the boundaries defined by the provided Extent
func (*ExtentList) DecodeMsg ¶
func (z *ExtentList) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (ExtentList) EncodeMsg ¶
func (z ExtentList) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (ExtentList) EncompassedBy ¶
func (el ExtentList) EncompassedBy(e Extent) bool
EncompassedBy returns true if the provided extent completely surrounds the boundaries of the subject ExtentList
func (ExtentList) Encompasses ¶
func (el ExtentList) Encompasses(e Extent) bool
Encompasses returns true if the provided extent is contained completely within boundaries of the subject ExtentList
func (ExtentList) Len ¶
func (el ExtentList) Len() int
Len returns the length of a slice of type ExtentList
func (ExtentList) Less ¶
func (el ExtentList) Less(i, j int) bool
Less returns true if element i in the ExtentList comes before j
func (ExtentList) MarshalMsg ¶
func (z ExtentList) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (ExtentList) Merge ¶
func (el ExtentList) Merge(el2 ExtentList, step time.Duration) ExtentList
Merge returns an Extentlist of el2 appended to el, sorted, and compressed
func (ExtentList) Msgsize ¶
func (z ExtentList) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (ExtentList) OutsideOf ¶
func (el ExtentList) OutsideOf(e Extent) bool
OutsideOf returns true if the provided extent falls completely outside of the boundaries of the subject extent list
func (ExtentList) Remove ¶
func (el ExtentList) Remove(r ExtentList, step time.Duration) ExtentList
Remove returns an Extentlist that is effectively the subject ExtentList minus the provided ExtentList. Both el and r are assumed to be sorted by Start time.
func (ExtentList) Size ¶
func (el ExtentList) Size() int
Size returns the approximate memory utilization in bytes of the timeseries
func (ExtentList) Splice ¶
func (el ExtentList) Splice(step, maxRange, spliceStep time.Duration, maxPoints int) ExtentList
Splice breaks apart extents in the list into smaller, contiguous extents, based on the provided splice sizing options, and returns the resulting spliced list. Splice assumes el is Compressed (e.g., Compress() was just ran or would be innefectual if ran)
func (ExtentList) String ¶
func (el ExtentList) String() string
String returns a string representation of the extentlist in the format startEpochSec1-endEpochSec1;startEpochSec2-endEpochSec2
func (ExtentList) Swap ¶
func (el ExtentList) Swap(i, j int)
Swap modifies an ExtentList by swapping the values in indexes i and j
func (ExtentList) TimestampCount ¶
func (el ExtentList) TimestampCount(d time.Duration) int64
TimestampCount returns the calculated number of timestamps based on the extents in the list and the provided duration
func (*ExtentList) UnmarshalMsg ¶
func (z *ExtentList) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type ExtentListLRU ¶
type ExtentListLRU []Extent
ExtentListLRU is a type of []Extent used for sorting the slice by LRU
func (ExtentListLRU) Clone ¶
func (el ExtentListLRU) Clone() ExtentListLRU
Clone returns a true copy of the ExtentListLRU
func (*ExtentListLRU) DecodeMsg ¶
func (z *ExtentListLRU) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (ExtentListLRU) EncodeMsg ¶
func (z ExtentListLRU) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (ExtentListLRU) Len ¶
func (el ExtentListLRU) Len() int
Len returns the length of an slice of type ExtentListLRU
func (ExtentListLRU) Less ¶
func (el ExtentListLRU) Less(i, j int) bool
Less returns true if element i in the ExtentListLRU comes before j
func (ExtentListLRU) MarshalMsg ¶
func (z ExtentListLRU) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (ExtentListLRU) Msgsize ¶
func (z ExtentListLRU) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (ExtentListLRU) String ¶
func (el ExtentListLRU) String() string
func (ExtentListLRU) Swap ¶
func (el ExtentListLRU) Swap(i, j int)
Swap modifies an ExtentListLRU by swapping the values in indexes i and j
func (*ExtentListLRU) UnmarshalMsg ¶
func (z *ExtentListLRU) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
func (ExtentListLRU) UpdateLastUsed ¶
func (el ExtentListLRU) UpdateLastUsed(lur Extent, step time.Duration) ExtentListLRU
UpdateLastUsed updates the ExtentListLRU's LastUsed field for the provided extent. The step is required in order to properly split extents.
type FieldDataType ¶
type FieldDataType byte
FieldDataType is a byte representing the data type of a Field when stored in a Point's Values list
const ( Unknown FieldDataType = iota Int64 Float64 String Bool Byte Int16 Uint64 DateTimeRFC3339 DateTimeRFC3339Nano DateTimeUnixSecs DateTimeUnixMilli DateTimeUnixMicro DateTimeUnixNano DateSQL TimeSQL DateTimeSQL Null )
Field Data Types
func (*FieldDataType) DecodeMsg ¶
func (z *FieldDataType) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (FieldDataType) EncodeMsg ¶
func (z FieldDataType) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (FieldDataType) MarshalMsg ¶
func (z FieldDataType) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (FieldDataType) Msgsize ¶
func (z FieldDataType) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*FieldDataType) UnmarshalMsg ¶
func (z *FieldDataType) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type FieldDefinition ¶
type FieldDefinition struct {
Name string `msg:"n" json:"name"`
DataType FieldDataType `msg:"t" json:"type"`
SDataType string `msg:"s" json:"stype,omitempty"`
OutputPosition int `msg:"p" json:"pos,omitempty"`
DefaultValue string `msg:"v,omitempty" json:"dv,omitempty"`
Role FieldRole `msg:"r,omitempty" json:"role,omitempty"`
ProviderData1 byte `msg:"d,omitempty" json:"providerData1,omitempty"`
}
FieldDefinition describes a field by name and type
func (*FieldDefinition) DecodeMsg ¶
func (z *FieldDefinition) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*FieldDefinition) EncodeMsg ¶
func (z *FieldDefinition) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*FieldDefinition) MarshalMsg ¶
func (z *FieldDefinition) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*FieldDefinition) Msgsize ¶
func (z *FieldDefinition) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (FieldDefinition) Size ¶
func (fd FieldDefinition) Size() int
Size returns the size of the FieldDefintions in bytes
func (FieldDefinition) String ¶
func (fd FieldDefinition) String() string
func (*FieldDefinition) UnmarshalMsg ¶
func (z *FieldDefinition) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type FieldDefinitionLookup ¶
type FieldDefinitionLookup map[string]FieldDefinition
FieldDefinitionLookup represents a map of FieldDefinitions keyed by name
func (*FieldDefinitionLookup) DecodeMsg ¶
func (z *FieldDefinitionLookup) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (FieldDefinitionLookup) EncodeMsg ¶
func (z FieldDefinitionLookup) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (FieldDefinitionLookup) MarshalMsg ¶
func (z FieldDefinitionLookup) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (FieldDefinitionLookup) Msgsize ¶
func (z FieldDefinitionLookup) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*FieldDefinitionLookup) UnmarshalMsg ¶
func (z *FieldDefinitionLookup) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type FieldDefinitions ¶
type FieldDefinitions []FieldDefinition
FieldDefinitions represents a list type FieldDefinition
func (FieldDefinitions) Clone ¶
func (fds FieldDefinitions) Clone() FieldDefinitions
func (*FieldDefinitions) DecodeMsg ¶
func (z *FieldDefinitions) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (FieldDefinitions) EncodeMsg ¶
func (z FieldDefinitions) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (FieldDefinitions) MarshalMsg ¶
func (z FieldDefinitions) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (FieldDefinitions) Msgsize ¶
func (z FieldDefinitions) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (FieldDefinitions) String ¶
func (fds FieldDefinitions) String() string
func (FieldDefinitions) ToLookup ¶
func (fds FieldDefinitions) ToLookup() FieldDefinitionLookup
func (*FieldDefinitions) UnmarshalMsg ¶
func (z *FieldDefinitions) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type FieldRole ¶
type FieldRole byte
FieldDataType is a byte representing the role of a Field (Value, Tag, etc)
func (FieldRole) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type List ¶
type List []Timeseries
func (List) Merge ¶
func (t List) Merge(useClone bool) Timeseries
Merge combines all Timesseries in t into a single Timeseries
type MarshalWriterFunc ¶
type MarshalWriterFunc func(Timeseries, *RequestOptions, int, io.Writer) error
MarshalWriterFunc describes a function that marshals a Timeseries to an io.Writer
type MarshalerFunc ¶
type MarshalerFunc func(Timeseries, *RequestOptions, int) ([]byte, error)
MarshalerFunc describes a function that marshals a Timeseries
type Modeler ¶
type Modeler struct {
WireUnmarshalerReader UnmarshalerReaderFunc `msg:"-"`
WireUnmarshaler UnmarshalerFunc `msg:"-"`
WireMarshaler MarshalerFunc `msg:"-"`
WireMarshalWriter MarshalWriterFunc `msg:"-"`
CacheUnmarshaler UnmarshalerFunc `msg:"-"`
CacheMarshaler MarshalerFunc `msg:"-"`
}
Modeler is a container object for Timeseries marshaling operations
func NewModeler ¶
func NewModeler( wu UnmarshalerFunc, wur UnmarshalerReaderFunc, wm MarshalerFunc, wmw MarshalWriterFunc, cu UnmarshalerFunc, cm MarshalerFunc, ) *Modeler
NewModeler factories a modeler with the provided modeling functions
func (Modeler) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type RequestOptions ¶
type RequestOptions struct {
// TimeFormat is a field usable by time series implementations to pass data between the parsed time range query
// and the data unmarshaler/marshaler to give indications about the format of Timestamps in the serialized dataset
TimeFormat byte
// OutputFormat is a field usable by time series implementations to pass data between the parsed time range query
// and the data unmarshaler/marshaler to give indications about the content type of the serialized output
OutputFormat byte
// FastForwardDisable indicates whether the Time Range Query result should include fast forward data
FastForwardDisable bool
// BaseTimestampFieldName holds the name of the Base Timestamp Field (in case it is aliased with AS) to help
// parse WHERE clauses during the initial parsing of a query
BaseTimestampFieldName string
// ProviderRequest holds the original provider request in the provider's structure
ProviderRequest any
}
RequestOptions holds request-specific information about a query
func (*RequestOptions) ExtractFastForwardDisabled ¶
func (ro *RequestOptions) ExtractFastForwardDisabled(input string)
ExtractFastForwardDisabled will look for the FastForwardUserDisableFlag in the provided string and set the flag appropriately in the subject RequestOptions
type SeriesFields ¶
type SeriesFields struct {
Timestamp FieldDefinition
Tags FieldDefinitions
Values FieldDefinitions
Untracked FieldDefinitions
ResultNameCol int
}
SeriesFields groups together a Series's Timestamp, Tags and Value Fields
func (*SeriesFields) DecodeMsg ¶
func (z *SeriesFields) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*SeriesFields) EncodeMsg ¶
func (z *SeriesFields) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*SeriesFields) MarshalMsg ¶
func (z *SeriesFields) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*SeriesFields) Msgsize ¶
func (z *SeriesFields) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*SeriesFields) UnmarshalMsg ¶
func (z *SeriesFields) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type TimeRangeQuery ¶
type TimeRangeQuery struct {
// Statement is the timeseries database query (with tokenized timeranges where present) requested by the user
Statement string `msg:"stmt"`
// Extent provides the start and end times for the request from a timeseries database
Extent Extent `msg:"ex"`
// Step indicates the amount of time in seconds between each datapoint in a TimeRangeQuery's resulting timeseries
Step time.Duration `msg:"-"`
// TemplateURL is used by some Backend providers for templatization of url parameters containing timestamps
TemplateURL *url.URL `msg:"-"`
// IsOffset is true if the query uses a relative offset modifier
IsOffset bool `msg:"-"`
// StepNS is the nanosecond representation for Step, required for MsgPack
StepNS int64 `msg:"step"`
// BackfillTolerance can be updated to override the overall backfill tolerance per query
BackfillTolerance time.Duration `msg:"-"`
// RecordLimit is the LIMIT value of the query
RecordLimit int `msg:"rl"`
// TimestampDefinition sets the definition for the Timestamp column in the in the timeseries based on the query
TimestampDefinition FieldDefinition `msg:"tfd"`
// TagFieldDefinitions contains the definitions for Tag columns in the timeseries, based on the query
TagFieldDefintions FieldDefinitions `msg:"-"`
// ParsedQuery is a member for the vendor-specific query object
ParsedQuery any `msg:"-"`
// OriginalBody is the original inbound request body untransformed if POST
OriginalBody []byte `msg:"-"`
// CacheKeyElements contains parts of the request that are used to derive a Cache Key
CacheKeyElements map[string]string `msg:"cke"`
}
TimeRangeQuery represents a timeseries database query parsed from an inbound HTTP request
func (*TimeRangeQuery) Clone ¶
func (trq *TimeRangeQuery) Clone() *TimeRangeQuery
Clone returns an exact copy of a TimeRangeQuery
func (*TimeRangeQuery) DecodeMsg ¶
func (z *TimeRangeQuery) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*TimeRangeQuery) EncodeMsg ¶
func (z *TimeRangeQuery) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*TimeRangeQuery) ExtractBackfillTolerance ¶
func (trq *TimeRangeQuery) ExtractBackfillTolerance(input string)
ExtractBackfillTolerance will look for the BackfillToleranceFlag in the provided string and return the BackfillTolerance value if present
func (*TimeRangeQuery) GetBackfillTolerance ¶
GetBackfillTolerance will return the backfill tolerance for the query based on the provided defaults, and any query-specific tolerance directives included in the query comments
func (*TimeRangeQuery) MarshalMsg ¶
func (z *TimeRangeQuery) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*TimeRangeQuery) Msgsize ¶
func (z *TimeRangeQuery) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*TimeRangeQuery) NormalizeExtent ¶
func (trq *TimeRangeQuery) NormalizeExtent()
NormalizeExtent adjusts the Start and End of a TimeRangeQuery's Extent to align against normalized boundaries.
func (*TimeRangeQuery) Size ¶
func (trq *TimeRangeQuery) Size() int
Size returns the memory usage in bytes of the TimeRangeQuery
func (*TimeRangeQuery) String ¶
func (trq *TimeRangeQuery) String() string
func (*TimeRangeQuery) UnmarshalMsg ¶
func (z *TimeRangeQuery) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type Timeseries ¶
type Timeseries interface {
// SetExtents sets the Extents of the Timeseries
SetExtents(ExtentList)
// Extents should return the list of time Extents having data present in the Timeseries
Extents() ExtentList
// VolatileExtents should return the list of time Extents in the cached Timeseries
// that should be re-fetched
VolatileExtents() ExtentList
// SetVolatileExtents sets the list of time Extents in the cached Timeseries
// that should be re-fetched
SetVolatileExtents(ExtentList)
// TimeStampCount should return the number of unique timestamps across the timeseries
TimestampCount() int64
// Step should return the Step Interval of the Timeseries
Step() time.Duration
// Merge should merge the Timeseries collection into the source Timeseries
Merge(bool, ...Timeseries)
// Sort should uniqueify and sort all series by Timestamp
Sort()
// Clone should return an exact duplicate source the Timeseries
Clone() Timeseries
// CroppedClone should return an exact duplicate source the Timeseries, excluding any
// timestamps from the source Timeseries that fall outside of the provided extent
CroppedClone(Extent) Timeseries
// CropToRange should reduce time range of the Timeseries to the provided Extent
CropToRange(Extent)
// CropToSize should reduce time range of the Timeseries to the provided element size using
// a least-recently-used methodology, while limiting the upper extent to the provided time,
// in order to support backfill tolerance
CropToSize(int, time.Time, Extent)
// SeriesCount returns the number of individual Series in the Timeseries object
SeriesCount() int
// ValueCount returns the count of all values across all Series in the Timeseries object
ValueCount() int64
// Size returns the approximate memory byte size of the timeseries object
Size() int64
// SetTimeRangeQuery sets the TimeRangeQuery associated with the Timeseries
SetTimeRangeQuery(*TimeRangeQuery)
}
Timeseries represents a Response Object from a Timeseries Database
type UnmarshalerFunc ¶
type UnmarshalerFunc func([]byte, *TimeRangeQuery) (Timeseries, error)
UnmarshalerFunc describes a function that unmarshals a Timeseries
type UnmarshalerReaderFunc ¶
type UnmarshalerReaderFunc func(io.Reader, *TimeRangeQuery) (Timeseries, error)
UnmarshalerReaderFunc describes a function that unmarshals a Timeseries from an io.Reader
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package dataset defines the interface for managing time seres objects and provides time range manipulation capabilities
|
Package dataset defines the interface for managing time seres objects and provides time range manipulation capabilities |
|
Package sqlparser provides customizations to the base sql parser that are specific to timeseries (for example, parsing trickster directives from comments)
|
Package sqlparser provides customizations to the base sql parser that are specific to timeseries (for example, parsing trickster directives from comments) |