operators

package
v0.0.0-...-aa375f8 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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 (*DeduplicateAndMerge) SeriesMetadata

func (d *DeduplicateAndMerge) 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 MergeConflict

type MergeConflict struct {
	FirstConflictingSeriesIndex  int // Will be the index of any input series in the case of a mixed float / histogram conflict.
	SecondConflictingSeriesIndex int // Will be -1 in the case of a mixed float / histogram conflict.
	Description                  string
	Timestamp                    int64
}

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 StringLiteral

type StringLiteral struct {
	Value string
	// contains filtered or unexported fields
}

func NewStringLiteral

func NewStringLiteral(
	value string,
	expressionPosition posrange.PositionRange,
) *StringLiteral

func (*StringLiteral) Close

func (s *StringLiteral) Close()

func (*StringLiteral) ExpressionPosition

func (s *StringLiteral) ExpressionPosition() posrange.PositionRange

func (*StringLiteral) GetValue

func (s *StringLiteral) GetValue() string

type Subquery

type Subquery struct {
	Inner                types.InstantVectorOperator
	ParentQueryTimeRange types.QueryTimeRange

	SubqueryTimestamp *int64 // Milliseconds since Unix epoch, only set if selector uses @ modifier (eg. metric{...} @ 123)
	SubqueryOffset    int64  // In milliseconds
	SubqueryRange     time.Duration
	// contains filtered or unexported fields
}

func NewSubquery

func NewSubquery(
	inner types.InstantVectorOperator,
	parentQueryTimeRange types.QueryTimeRange,
	subqueryTimestamp *int64,
	subqueryOffset time.Duration,
	subqueryRange time.Duration,
	expressionPosition posrange.PositionRange,
	memoryConsumptionTracker *limiting.MemoryConsumptionTracker,
) *Subquery

func (*Subquery) Close

func (s *Subquery) Close()

func (*Subquery) ExpressionPosition

func (s *Subquery) ExpressionPosition() posrange.PositionRange

func (*Subquery) NextSeries

func (s *Subquery) NextSeries(ctx context.Context) error

func (*Subquery) NextStepSamples

func (s *Subquery) NextStepSamples() (*types.RangeVectorStepData, error)

func (*Subquery) Range

func (s *Subquery) Range() time.Duration

func (*Subquery) SeriesMetadata

func (s *Subquery) SeriesMetadata(ctx context.Context) ([]types.SeriesMetadata, error)

func (*Subquery) StepCount

func (s *Subquery) StepCount() int

type TestOperator

type TestOperator struct {
	Series []labels.Labels
	Data   []types.InstantVectorSeriesData
}

TestOperator is an InstantVectorOperator used only in tests.

func (*TestOperator) Close

func (t *TestOperator) Close()

func (*TestOperator) ExpressionPosition

func (t *TestOperator) ExpressionPosition() posrange.PositionRange

func (*TestOperator) NextSeries

func (*TestOperator) SeriesMetadata

func (t *TestOperator) SeriesMetadata(_ context.Context) ([]types.SeriesMetadata, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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