Documentation
¶
Index ¶
- func Empty(b Buffer) bool
- type Buffer
- type FunctionArgs
- type FunctionCall
- type GenericRingBuffer
- func (r *GenericRingBuffer) Eval(ctx context.Context, scalarArg float64, scalarArg2 float64, ...) (float64, *histogram.FloatHistogram, bool, error)
- func (r *GenericRingBuffer) MaxT() int64
- func (r *GenericRingBuffer) Push(t int64, v Value)
- func (r *GenericRingBuffer) ReadIntoLast(f func(*Sample))
- func (r *GenericRingBuffer) Reset(mint int64, evalt int64)
- func (r *GenericRingBuffer) SampleCount() int
- type OverTimeBuffer
- func NewCountOverTimeBuffer(opts query.Options, selectRange, offset int64) *OverTimeBuffer
- func NewMaxOverTimeBuffer(opts query.Options, selectRange, offset int64) *OverTimeBuffer
- func NewMinOverTimeBuffer(opts query.Options, selectRange, offset int64) *OverTimeBuffer
- func NewSumOverTimeBuffer(opts query.Options, selectRange, offset int64) *OverTimeBuffer
- func (r *OverTimeBuffer) Eval(ctx context.Context, _, _ float64, _ int64) (float64, *histogram.FloatHistogram, bool, error)
- func (r *OverTimeBuffer) MaxT() int64
- func (r *OverTimeBuffer) Push(t int64, v Value)
- func (r *OverTimeBuffer) ReadIntoLast(func(*Sample))
- func (r *OverTimeBuffer) Reset(mint int64, evalt int64)
- func (r *OverTimeBuffer) SampleCount() int
- type RateBuffer
- func (r *RateBuffer) Eval(ctx context.Context, _, _ float64, _ int64) (float64, *histogram.FloatHistogram, bool, error)
- func (r *RateBuffer) MaxT() int64
- func (r *RateBuffer) Push(t int64, v Value)
- func (r *RateBuffer) ReadIntoLast(func(*Sample))
- func (r *RateBuffer) Reset(mint int64, evalt int64)
- func (r *RateBuffer) SampleCount() int
- type Sample
- type SamplesBuffer
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Buffer ¶
type Buffer interface {
MaxT() int64
Push(t int64, v Value)
Reset(mint int64, evalt int64)
Eval(ctx context.Context, _, _ float64, _ int64) (float64, *histogram.FloatHistogram, bool, error)
SampleCount() int
// to handle extlookback properly, only used by buffers that implement xincrease or xrate
ReadIntoLast(f func(*Sample))
}
type FunctionArgs ¶
type FunctionArgs struct {
Samples []Sample
StepTime int64
SelectRange int64
Offset int64
MetricAppearedTs int64
// quantile_over_time and predict_linear use one, so we only use one here.
ScalarPoint float64
ScalarPoint2 float64 // only for double_exponential_smoothing (trend factor)
// contains filtered or unexported fields
}
type FunctionCall ¶
type FunctionCall func(f FunctionArgs) (float64, *histogram.FloatHistogram, bool, error)
func NewRangeVectorFunc ¶
func NewRangeVectorFunc(name string) (FunctionCall, error)
type GenericRingBuffer ¶
type GenericRingBuffer struct {
// contains filtered or unexported fields
}
func New ¶
func New(ctx context.Context, size int, selectRange, offset int64, call FunctionCall) *GenericRingBuffer
func NewWithExtLookback ¶
func NewWithExtLookback(ctx context.Context, size int, selectRange, offset, extLookback int64, call FunctionCall) *GenericRingBuffer
func (*GenericRingBuffer) MaxT ¶
func (r *GenericRingBuffer) MaxT() int64
MaxT returns the maximum timestamp of the ring buffer. If the ring buffer is empty, it returns math.MinInt64.
func (*GenericRingBuffer) Push ¶
func (r *GenericRingBuffer) Push(t int64, v Value)
Push adds a new sample to the buffer.
func (*GenericRingBuffer) ReadIntoLast ¶
func (r *GenericRingBuffer) ReadIntoLast(f func(*Sample))
ReadIntoLast reads a sample into the last slot in the buffer, replacing the existing sample.
func (*GenericRingBuffer) Reset ¶
func (r *GenericRingBuffer) Reset(mint int64, evalt int64)
func (*GenericRingBuffer) SampleCount ¶
func (r *GenericRingBuffer) SampleCount() int
type OverTimeBuffer ¶
type OverTimeBuffer struct {
// contains filtered or unexported fields
}
OverTimeBuffer is a Buffer which can calculate [agg]_over_time for a series in a streaming manner, calculating the value incrementally for each step where the sample is used.
func NewCountOverTimeBuffer ¶
func NewCountOverTimeBuffer(opts query.Options, selectRange, offset int64) *OverTimeBuffer
NewCountOverTimeBuffer creates a new OverTimeBuffer for the count_over_time function.
func NewMaxOverTimeBuffer ¶
func NewMaxOverTimeBuffer(opts query.Options, selectRange, offset int64) *OverTimeBuffer
NewMaxOverTimeBuffer creates a new OverTimeBuffer for the max_over_time function.
func NewMinOverTimeBuffer ¶
func NewMinOverTimeBuffer(opts query.Options, selectRange, offset int64) *OverTimeBuffer
NewMinOverTime creates a new OverTimeBuffer for the min_over_time function.
func NewSumOverTimeBuffer ¶
func NewSumOverTimeBuffer(opts query.Options, selectRange, offset int64) *OverTimeBuffer
NewSumOverTime creates a new OverTimeBuffer for the sum_over_time function.
func (*OverTimeBuffer) Eval ¶
func (r *OverTimeBuffer) Eval(ctx context.Context, _, _ float64, _ int64) (float64, *histogram.FloatHistogram, bool, error)
func (*OverTimeBuffer) MaxT ¶
func (r *OverTimeBuffer) MaxT() int64
func (*OverTimeBuffer) Push ¶
func (r *OverTimeBuffer) Push(t int64, v Value)
func (*OverTimeBuffer) ReadIntoLast ¶
func (r *OverTimeBuffer) ReadIntoLast(func(*Sample))
func (*OverTimeBuffer) Reset ¶
func (r *OverTimeBuffer) Reset(mint int64, evalt int64)
func (*OverTimeBuffer) SampleCount ¶
func (r *OverTimeBuffer) SampleCount() int
type RateBuffer ¶
type RateBuffer struct {
// contains filtered or unexported fields
}
RateBuffer is a Buffer which can calculate rate, increase and delta for a series in a streaming manner, calculating the value incrementally for each step where the sample is used.
func NewRateBuffer ¶
func NewRateBuffer(ctx context.Context, opts query.Options, isCounter, isRate bool, selectRange, offset int64) *RateBuffer
NewRateBuffer creates a new RateBuffer.
func (*RateBuffer) Eval ¶
func (r *RateBuffer) Eval(ctx context.Context, _, _ float64, _ int64) (float64, *histogram.FloatHistogram, bool, error)
func (*RateBuffer) MaxT ¶
func (r *RateBuffer) MaxT() int64
func (*RateBuffer) Push ¶
func (r *RateBuffer) Push(t int64, v Value)
func (*RateBuffer) ReadIntoLast ¶
func (r *RateBuffer) ReadIntoLast(func(*Sample))
func (*RateBuffer) Reset ¶
func (r *RateBuffer) Reset(mint int64, evalt int64)
func (*RateBuffer) SampleCount ¶
func (r *RateBuffer) SampleCount() int
type SamplesBuffer ¶
type SamplesBuffer GenericRingBuffer
type Value ¶
type Value struct {
F float64
H *histogram.FloatHistogram
}