Documentation ¶
Index ¶
- type Aggregation
- type DeduplicateAndMerge
- func (d *DeduplicateAndMerge) Close()
- func (d *DeduplicateAndMerge) ExpressionPosition() posrange.PositionRange
- func (d *DeduplicateAndMerge) NextSeries(ctx context.Context) (types.InstantVectorSeriesData, error)
- func (d *DeduplicateAndMerge) SeriesMetadata(ctx context.Context) ([]types.SeriesMetadata, error)
- type FunctionOverInstantVector
- func (m *FunctionOverInstantVector) Close()
- func (m *FunctionOverInstantVector) ExpressionPosition() posrange.PositionRange
- func (m *FunctionOverInstantVector) NextSeries(ctx context.Context) (types.InstantVectorSeriesData, error)
- func (m *FunctionOverInstantVector) SeriesMetadata(ctx context.Context) ([]types.SeriesMetadata, error)
- type FunctionOverRangeVector
- func (m *FunctionOverRangeVector) Close()
- func (m *FunctionOverRangeVector) ExpressionPosition() posrange.PositionRange
- func (m *FunctionOverRangeVector) NextSeries(ctx context.Context) (types.InstantVectorSeriesData, error)
- func (m *FunctionOverRangeVector) SeriesMetadata(ctx context.Context) ([]types.SeriesMetadata, error)
- type InstantVectorOperatorBuffer
- type InstantVectorSelector
- func (v *InstantVectorSelector) Close()
- func (v *InstantVectorSelector) ExpressionPosition() posrange.PositionRange
- func (v *InstantVectorSelector) NextSeries(ctx context.Context) (types.InstantVectorSeriesData, error)
- func (v *InstantVectorSelector) SeriesMetadata(ctx context.Context) ([]types.SeriesMetadata, error)
- type InstantVectorToScalar
- type MergeConflict
- type MetricNames
- type RangeVectorSelector
- func (m *RangeVectorSelector) Close()
- func (m *RangeVectorSelector) ExpressionPosition() posrange.PositionRange
- func (m *RangeVectorSelector) NextSeries(ctx context.Context) error
- func (m *RangeVectorSelector) NextStepSamples(floats *types.FPointRingBuffer, histograms *types.HPointRingBuffer) (types.RangeVectorStepData, error)
- func (m *RangeVectorSelector) Range() time.Duration
- func (m *RangeVectorSelector) SeriesMetadata(ctx context.Context) ([]types.SeriesMetadata, error)
- func (m *RangeVectorSelector) StepCount() int
- type ScalarConstant
- type ScalarScalarBinaryOperation
- type ScalarToInstantVector
- func (s *ScalarToInstantVector) Close()
- func (s *ScalarToInstantVector) ExpressionPosition() posrange.PositionRange
- func (s *ScalarToInstantVector) NextSeries(ctx context.Context) (types.InstantVectorSeriesData, error)
- func (s *ScalarToInstantVector) SeriesMetadata(_ context.Context) ([]types.SeriesMetadata, error)
- type Selector
- type UnaryNegationOfScalar
- type VectorScalarBinaryOperation
- func (v *VectorScalarBinaryOperation) Close()
- func (v *VectorScalarBinaryOperation) ExpressionPosition() posrange.PositionRange
- func (v *VectorScalarBinaryOperation) NextSeries(ctx context.Context) (types.InstantVectorSeriesData, error)
- func (v *VectorScalarBinaryOperation) SeriesMetadata(ctx context.Context) ([]types.SeriesMetadata, error)
- type VectorVectorBinaryOperation
- func (b *VectorVectorBinaryOperation) Close()
- func (b *VectorVectorBinaryOperation) ExpressionPosition() posrange.PositionRange
- func (b *VectorVectorBinaryOperation) NextSeries(ctx context.Context) (types.InstantVectorSeriesData, error)
- func (b *VectorVectorBinaryOperation) SeriesMetadata(ctx context.Context) ([]types.SeriesMetadata, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Aggregation ¶
type Aggregation struct { Inner types.InstantVectorOperator TimeRange types.QueryTimeRange Grouping []string // If this is a 'without' aggregation, NewAggregation will ensure that this slice contains __name__. Without bool MemoryConsumptionTracker *limiting.MemoryConsumptionTracker Annotations *annotations.Annotations // contains filtered or unexported fields }
func NewAggregation ¶
func NewAggregation( inner types.InstantVectorOperator, timeRange types.QueryTimeRange, grouping []string, without bool, op parser.ItemType, memoryConsumptionTracker *limiting.MemoryConsumptionTracker, annotations *annotations.Annotations, expressionPosition posrange.PositionRange, ) (*Aggregation, error)
func (*Aggregation) Close ¶
func (a *Aggregation) Close()
func (*Aggregation) ExpressionPosition ¶
func (a *Aggregation) ExpressionPosition() posrange.PositionRange
func (*Aggregation) NextSeries ¶
func (a *Aggregation) NextSeries(ctx context.Context) (types.InstantVectorSeriesData, error)
func (*Aggregation) SeriesMetadata ¶
func (a *Aggregation) SeriesMetadata(ctx context.Context) ([]types.SeriesMetadata, error)
type DeduplicateAndMerge ¶
type DeduplicateAndMerge struct { Inner types.InstantVectorOperator MemoryConsumptionTracker *limiting.MemoryConsumptionTracker // contains filtered or unexported fields }
func NewDeduplicateAndMerge ¶
func NewDeduplicateAndMerge(inner types.InstantVectorOperator, memoryConsumptionTracker *limiting.MemoryConsumptionTracker) *DeduplicateAndMerge
func (*DeduplicateAndMerge) Close ¶
func (d *DeduplicateAndMerge) Close()
func (*DeduplicateAndMerge) ExpressionPosition ¶
func (d *DeduplicateAndMerge) ExpressionPosition() posrange.PositionRange
func (*DeduplicateAndMerge) NextSeries ¶
func (d *DeduplicateAndMerge) NextSeries(ctx context.Context) (types.InstantVectorSeriesData, error)
func (*DeduplicateAndMerge) SeriesMetadata ¶
func (d *DeduplicateAndMerge) SeriesMetadata(ctx context.Context) ([]types.SeriesMetadata, error)
type FunctionOverInstantVector ¶
type FunctionOverInstantVector struct { // At the moment no instant-vector promql function takes more than one instant-vector // as an argument. We can assume this will always be the Inner operator and therefore // what we use for the SeriesMetadata. Inner types.InstantVectorOperator MemoryConsumptionTracker *limiting.MemoryConsumptionTracker Func functions.FunctionOverInstantVector // contains filtered or unexported fields }
FunctionOverInstantVector performs a function over each series in an instant vector.
func NewFunctionOverInstantVector ¶
func NewFunctionOverInstantVector( inner types.InstantVectorOperator, memoryConsumptionTracker *limiting.MemoryConsumptionTracker, f functions.FunctionOverInstantVector, expressionPosition posrange.PositionRange, ) *FunctionOverInstantVector
func (*FunctionOverInstantVector) Close ¶
func (m *FunctionOverInstantVector) Close()
func (*FunctionOverInstantVector) ExpressionPosition ¶
func (m *FunctionOverInstantVector) ExpressionPosition() posrange.PositionRange
func (*FunctionOverInstantVector) NextSeries ¶
func (m *FunctionOverInstantVector) NextSeries(ctx context.Context) (types.InstantVectorSeriesData, error)
func (*FunctionOverInstantVector) SeriesMetadata ¶
func (m *FunctionOverInstantVector) SeriesMetadata(ctx context.Context) ([]types.SeriesMetadata, error)
type FunctionOverRangeVector ¶
type FunctionOverRangeVector struct { Inner types.RangeVectorOperator MemoryConsumptionTracker *limiting.MemoryConsumptionTracker Func functions.FunctionOverRangeVector Annotations *annotations.Annotations // contains filtered or unexported fields }
FunctionOverRangeVector performs a rate calculation over a range vector.
func NewFunctionOverRangeVector ¶
func NewFunctionOverRangeVector( inner types.RangeVectorOperator, memoryConsumptionTracker *limiting.MemoryConsumptionTracker, f functions.FunctionOverRangeVector, annotations *annotations.Annotations, expressionPosition posrange.PositionRange, ) *FunctionOverRangeVector
func (*FunctionOverRangeVector) Close ¶
func (m *FunctionOverRangeVector) Close()
func (*FunctionOverRangeVector) ExpressionPosition ¶
func (m *FunctionOverRangeVector) ExpressionPosition() posrange.PositionRange
func (*FunctionOverRangeVector) NextSeries ¶
func (m *FunctionOverRangeVector) NextSeries(ctx context.Context) (types.InstantVectorSeriesData, error)
func (*FunctionOverRangeVector) SeriesMetadata ¶
func (m *FunctionOverRangeVector) SeriesMetadata(ctx context.Context) ([]types.SeriesMetadata, error)
type InstantVectorOperatorBuffer ¶
type InstantVectorOperatorBuffer struct {
// contains filtered or unexported fields
}
InstantVectorOperatorBuffer buffers series data until it is needed by an operator.
For example, if this buffer is being used for a binary operation and the source operator produces series in order A, B, C, but their corresponding output series from the binary operation are in order B, A, C, InstantVectorOperatorBuffer will buffer the data for series A while series B is produced, then return series A when needed.
func NewInstantVectorOperatorBuffer ¶
func NewInstantVectorOperatorBuffer(source types.InstantVectorOperator, seriesUsed []bool, memoryConsumptionTracker *limiting.MemoryConsumptionTracker) *InstantVectorOperatorBuffer
func (*InstantVectorOperatorBuffer) Close ¶
func (b *InstantVectorOperatorBuffer) Close()
func (*InstantVectorOperatorBuffer) GetSeries ¶
func (b *InstantVectorOperatorBuffer) GetSeries(ctx context.Context, seriesIndices []int) ([]types.InstantVectorSeriesData, error)
GetSeries returns the data for the series in seriesIndices. The returned slice is only safe to use until GetSeries is called again. seriesIndices should be sorted in ascending order to avoid unnecessary buffering.
type InstantVectorSelector ¶
type InstantVectorSelector struct { Selector *Selector MemoryConsumptionTracker *limiting.MemoryConsumptionTracker // contains filtered or unexported fields }
func (*InstantVectorSelector) Close ¶
func (v *InstantVectorSelector) Close()
func (*InstantVectorSelector) ExpressionPosition ¶
func (v *InstantVectorSelector) ExpressionPosition() posrange.PositionRange
func (*InstantVectorSelector) NextSeries ¶
func (v *InstantVectorSelector) NextSeries(ctx context.Context) (types.InstantVectorSeriesData, error)
func (*InstantVectorSelector) SeriesMetadata ¶
func (v *InstantVectorSelector) SeriesMetadata(ctx context.Context) ([]types.SeriesMetadata, error)
type InstantVectorToScalar ¶
type InstantVectorToScalar struct { Inner types.InstantVectorOperator TimeRange types.QueryTimeRange MemoryConsumptionTracker *limiting.MemoryConsumptionTracker // contains filtered or unexported fields }
InstantVectorToScalar is an operator that implements the scalar() function.
func NewInstantVectorToScalar ¶
func NewInstantVectorToScalar( inner types.InstantVectorOperator, timeRange types.QueryTimeRange, memoryConsumptionTracker *limiting.MemoryConsumptionTracker, expressionPosition posrange.PositionRange, ) *InstantVectorToScalar
func (*InstantVectorToScalar) Close ¶
func (i *InstantVectorToScalar) Close()
func (*InstantVectorToScalar) ExpressionPosition ¶
func (i *InstantVectorToScalar) ExpressionPosition() posrange.PositionRange
func (*InstantVectorToScalar) GetValues ¶
func (i *InstantVectorToScalar) GetValues(ctx context.Context) (types.ScalarData, error)
type MergeConflict ¶
type MergeConflict struct {
// contains filtered or unexported fields
}
func MergeSeries ¶
func MergeSeries(data []types.InstantVectorSeriesData, sourceSeriesIndices []int, memoryConsumptionTracker *limiting.MemoryConsumptionTracker) (types.InstantVectorSeriesData, *MergeConflict, error)
MergeSeries merges the series in data into a single InstantVectorSeriesData, or returns information about a conflict between series.
For example, MergeSeries would return a single series with points [1, 2, 3] given the two input series:
1 2 _ _ _ 3
MergeSeries is optimised for the case where there is only one source series, or the source series do not overlap, as in the example above.
sourceSeriesIndices should contain the indices of the original series in data. For example, if data contains the first, fourth and tenth series, then sourceSeriesIndices would be [0, 3, 9]. These indices are used to include source series information when a conflict occurs.
MergeSeries re-orders both data and sourceSeriesIndices.
type MetricNames ¶
type MetricNames struct {
// contains filtered or unexported fields
}
MetricNames captures and stores the metric names of each series for later use in an operator.
For example, it can be used to retrieve the metric name of a series for use in an annotation that can only be generated once the series data has been examined.
func (*MetricNames) CaptureMetricNames ¶
func (n *MetricNames) CaptureMetricNames(metadata []types.SeriesMetadata)
func (*MetricNames) GetMetricNameForSeries ¶
func (n *MetricNames) GetMetricNameForSeries(seriesIndex int) string
type RangeVectorSelector ¶
type RangeVectorSelector struct { Selector *Selector // contains filtered or unexported fields }
func (*RangeVectorSelector) Close ¶
func (m *RangeVectorSelector) Close()
func (*RangeVectorSelector) ExpressionPosition ¶
func (m *RangeVectorSelector) ExpressionPosition() posrange.PositionRange
func (*RangeVectorSelector) NextSeries ¶
func (m *RangeVectorSelector) NextSeries(ctx context.Context) error
func (*RangeVectorSelector) NextStepSamples ¶
func (m *RangeVectorSelector) NextStepSamples(floats *types.FPointRingBuffer, histograms *types.HPointRingBuffer) (types.RangeVectorStepData, error)
func (*RangeVectorSelector) Range ¶
func (m *RangeVectorSelector) Range() time.Duration
func (*RangeVectorSelector) SeriesMetadata ¶
func (m *RangeVectorSelector) SeriesMetadata(ctx context.Context) ([]types.SeriesMetadata, error)
func (*RangeVectorSelector) StepCount ¶
func (m *RangeVectorSelector) StepCount() int
type ScalarConstant ¶
type ScalarConstant struct { Value float64 TimeRange types.QueryTimeRange MemoryConsumptionTracker *limiting.MemoryConsumptionTracker // contains filtered or unexported fields }
func NewScalarConstant ¶
func NewScalarConstant( value float64, timeRange types.QueryTimeRange, memoryConsumptionTracker *limiting.MemoryConsumptionTracker, expressionPosition posrange.PositionRange, ) *ScalarConstant
func (*ScalarConstant) Close ¶
func (s *ScalarConstant) Close()
func (*ScalarConstant) ExpressionPosition ¶
func (s *ScalarConstant) ExpressionPosition() posrange.PositionRange
func (*ScalarConstant) GetValues ¶
func (s *ScalarConstant) GetValues(_ context.Context) (types.ScalarData, error)
type ScalarScalarBinaryOperation ¶
type ScalarScalarBinaryOperation struct { Left types.ScalarOperator Right types.ScalarOperator Op parser.ItemType MemoryConsumptionTracker *limiting.MemoryConsumptionTracker // contains filtered or unexported fields }
func NewScalarScalarBinaryOperation ¶
func NewScalarScalarBinaryOperation( left, right types.ScalarOperator, op parser.ItemType, memoryConsumptionTracker *limiting.MemoryConsumptionTracker, expressionPosition posrange.PositionRange, ) (*ScalarScalarBinaryOperation, error)
func (*ScalarScalarBinaryOperation) Close ¶
func (s *ScalarScalarBinaryOperation) Close()
func (*ScalarScalarBinaryOperation) ExpressionPosition ¶
func (s *ScalarScalarBinaryOperation) ExpressionPosition() posrange.PositionRange
func (*ScalarScalarBinaryOperation) GetValues ¶
func (s *ScalarScalarBinaryOperation) GetValues(ctx context.Context) (types.ScalarData, error)
type ScalarToInstantVector ¶
type ScalarToInstantVector struct { Scalar types.ScalarOperator // contains filtered or unexported fields }
ScalarToInstantVector is an operator that implements the vector() function.
func NewScalarToInstantVector ¶
func NewScalarToInstantVector(scalar types.ScalarOperator, expressionPosition posrange.PositionRange) *ScalarToInstantVector
func (*ScalarToInstantVector) Close ¶
func (s *ScalarToInstantVector) Close()
func (*ScalarToInstantVector) ExpressionPosition ¶
func (s *ScalarToInstantVector) ExpressionPosition() posrange.PositionRange
func (*ScalarToInstantVector) NextSeries ¶
func (s *ScalarToInstantVector) NextSeries(ctx context.Context) (types.InstantVectorSeriesData, error)
func (*ScalarToInstantVector) SeriesMetadata ¶
func (s *ScalarToInstantVector) SeriesMetadata(_ context.Context) ([]types.SeriesMetadata, error)
type Selector ¶
type Selector struct { Queryable storage.Queryable TimeRange types.QueryTimeRange Timestamp *int64 // Milliseconds since Unix epoch, only set if selector uses @ modifier (eg. metric{...} @ 123) Offset int64 // In milliseconds Matchers []*labels.Matcher ExpressionPosition posrange.PositionRange // Set for instant vector selectors, otherwise 0. LookbackDelta time.Duration // Set for range vector selectors, otherwise 0. Range time.Duration // contains filtered or unexported fields }
func (*Selector) SeriesMetadata ¶
type UnaryNegationOfScalar ¶
type UnaryNegationOfScalar struct { Inner types.ScalarOperator // contains filtered or unexported fields }
func NewUnaryNegationOfScalar ¶
func NewUnaryNegationOfScalar(inner types.ScalarOperator, expressionPosition posrange.PositionRange) *UnaryNegationOfScalar
func (*UnaryNegationOfScalar) Close ¶
func (u *UnaryNegationOfScalar) Close()
func (*UnaryNegationOfScalar) ExpressionPosition ¶
func (u *UnaryNegationOfScalar) ExpressionPosition() posrange.PositionRange
func (*UnaryNegationOfScalar) GetValues ¶
func (u *UnaryNegationOfScalar) GetValues(ctx context.Context) (types.ScalarData, error)
type VectorScalarBinaryOperation ¶
type VectorScalarBinaryOperation struct { Scalar types.ScalarOperator Vector types.InstantVectorOperator ScalarIsLeftSide bool Op parser.ItemType ReturnBool bool MemoryConsumptionTracker *limiting.MemoryConsumptionTracker // contains filtered or unexported fields }
VectorScalarBinaryOperation represents a binary operation between an instant vector and a scalar such as "<expr> + 2" or "3 * <expr>".
func NewVectorScalarBinaryOperation ¶
func NewVectorScalarBinaryOperation( scalar types.ScalarOperator, vector types.InstantVectorOperator, scalarIsLeftSide bool, op parser.ItemType, returnBool bool, timeRange types.QueryTimeRange, memoryConsumptionTracker *limiting.MemoryConsumptionTracker, annotations *annotations.Annotations, expressionPosition posrange.PositionRange, ) (*VectorScalarBinaryOperation, error)
func (*VectorScalarBinaryOperation) Close ¶
func (v *VectorScalarBinaryOperation) Close()
func (*VectorScalarBinaryOperation) ExpressionPosition ¶
func (v *VectorScalarBinaryOperation) ExpressionPosition() posrange.PositionRange
func (*VectorScalarBinaryOperation) NextSeries ¶
func (v *VectorScalarBinaryOperation) NextSeries(ctx context.Context) (types.InstantVectorSeriesData, error)
func (*VectorScalarBinaryOperation) SeriesMetadata ¶
func (v *VectorScalarBinaryOperation) SeriesMetadata(ctx context.Context) ([]types.SeriesMetadata, error)
type VectorVectorBinaryOperation ¶
type VectorVectorBinaryOperation struct { Left types.InstantVectorOperator Right types.InstantVectorOperator Op parser.ItemType ReturnBool bool MemoryConsumptionTracker *limiting.MemoryConsumptionTracker VectorMatching parser.VectorMatching // contains filtered or unexported fields }
VectorVectorBinaryOperation represents a binary operation between instant vectors such as "<expr> + <expr>" or "<expr> - <expr>".
func NewVectorVectorBinaryOperation ¶
func NewVectorVectorBinaryOperation( left types.InstantVectorOperator, right types.InstantVectorOperator, vectorMatching parser.VectorMatching, op parser.ItemType, returnBool bool, memoryConsumptionTracker *limiting.MemoryConsumptionTracker, annotations *annotations.Annotations, expressionPosition posrange.PositionRange, ) (*VectorVectorBinaryOperation, error)
func (*VectorVectorBinaryOperation) Close ¶
func (b *VectorVectorBinaryOperation) Close()
func (*VectorVectorBinaryOperation) ExpressionPosition ¶
func (b *VectorVectorBinaryOperation) ExpressionPosition() posrange.PositionRange
func (*VectorVectorBinaryOperation) NextSeries ¶
func (b *VectorVectorBinaryOperation) NextSeries(ctx context.Context) (types.InstantVectorSeriesData, error)
func (*VectorVectorBinaryOperation) SeriesMetadata ¶
func (b *VectorVectorBinaryOperation) SeriesMetadata(ctx context.Context) ([]types.SeriesMetadata, error)
SeriesMetadata returns the series expected to be produced by this operator.
Note that it is possible that this method returns a series which will not have any points, as the list of possible output series is generated based solely on the series labels, not their data.
For example, if this operator is for a range query with the expression "left_metric + right_metric", but left_metric has points at T=0 and T=1 in the query range, and right_metric has points at T=2 and T=3 in the query range, then SeriesMetadata will return a series, but NextSeries will return no points for that series.
If this affects many series in the query, this may cause consuming operators to be less efficient, but in practice this rarely happens.
(The alternative would be to compute the entire result here in SeriesMetadata and only return the series that contain points, but that would mean we'd need to hold the entire result in memory at once, which we want to avoid.)
Source Files ¶
- aggregation.go
- deduplicate_and_merge.go
- function_over_instant_vector.go
- function_over_range_vector.go
- instant_vector_selector.go
- instant_vector_to_scalar.go
- metric_names.go
- operator_buffer.go
- range_vector_selector.go
- scalar_constant.go
- scalar_scalar_binary_operation.go
- scalar_to_instant_vector.go
- selector.go
- series_merging.go
- unary_negation_scalar.go
- vector_scalar_binary_operation.go
- vector_vector_binary_operation.go