model

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Series

type Series struct {
	// ID is a numerical, zero-based identifier for a series.
	// It allows using slices instead of maps for fast lookups.
	ID     uint64
	Metric labels.Labels
}

type StepVector

type StepVector struct {
	T         int64
	SampleIDs []uint64
	Samples   []float64

	HistogramIDs []uint64
	Histograms   []*histogram.FloatHistogram
}

func (*StepVector) AppendHistogram

func (s *StepVector) AppendHistogram(histogramID uint64, h *histogram.FloatHistogram)

func (*StepVector) AppendHistogramWithSizeHint added in v0.5.0

func (s *StepVector) AppendHistogramWithSizeHint(histogramID uint64, h *histogram.FloatHistogram, hint int)

AppendHistogramWithSizeHint appends a histogram and lazily pre-allocates capacity if needed. Use this when you know the expected number of histograms to avoid repeated slice growth.

func (*StepVector) AppendHistograms

func (s *StepVector) AppendHistograms(histogramIDs []uint64, hs []*histogram.FloatHistogram)

func (*StepVector) AppendSample

func (s *StepVector) AppendSample(id uint64, val float64)

func (*StepVector) AppendSampleWithSizeHint added in v0.5.0

func (s *StepVector) AppendSampleWithSizeHint(id uint64, val float64, hint int)

AppendSampleWithSizeHint appends a sample and lazily pre-allocates capacity if needed. Use this when you know the expected number of samples to avoid repeated slice growth.

func (*StepVector) AppendSamples

func (s *StepVector) AppendSamples(ids []uint64, vals []float64)

func (*StepVector) RemoveHistogram

func (s *StepVector) RemoveHistogram(index int)

func (*StepVector) RemoveSample

func (s *StepVector) RemoveSample(index int)

func (*StepVector) Reset added in v0.5.0

func (s *StepVector) Reset(t int64)

Reset resets the StepVector to the given timestamp while preserving slice capacity.

type VectorOperator

type VectorOperator interface {
	// Next yields vectors of samples from all series for one or more execution steps.
	// The caller provides a buffer (buf) to be filled with StepVectors.
	// Returns the number of StepVectors written to buf and any error encountered.
	// A return value of 0 indicates no more data is available.
	Next(ctx context.Context, buf []StepVector) (int, error)

	// Series returns all series that the operator will process during Next results.
	// The result can be used by upstream operators to allocate output tables and buffers
	// before starting to process samples.
	Series(ctx context.Context) ([]labels.Labels, error)

	// Explain returns human-readable explanation of the current operator and optional nested operators.
	Explain() (next []VectorOperator)

	fmt.Stringer
}

VectorOperator performs operations on series in step by step fashion.

Jump to

Keyboard shortcuts

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