testwal

package
v0.311.1 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Records

type Records struct {
	Series          []record.RefSeries
	Samples         []record.RefSample
	Histograms      []record.RefHistogramSample
	FloatHistograms []record.RefFloatHistogramSample
	Exemplars       []record.RefExemplar
	Metadata        []record.RefMetadata
}

Records represents batches of generated WAL records.

func GenerateRecords

func GenerateRecords(c RecordsCase) (ret Records)

GenerateRecords generates batches of WAL records for a given RecordsCase. Batches represents set of series with the given number of counter samples, histograms, etc. per each series ref.

type RecordsCase

type RecordsCase struct {
	Name string

	Series                   int
	SamplesPerSeries         int
	HistogramsPerSeries      int
	FloatHistogramsPerSeries int
	ExemplarsPerSeries       int

	ExtraLabels []labels.Label

	// RefPadding represents a padding to add to Series refs.
	RefPadding int
	// LabelsFn allows injecting custom labels, by default it's a test_metric_%d with ExtraLabels.
	LabelsFn func(lb *labels.ScratchBuilder, ref int) labels.Labels
	// TsFn allows injecting custom sample timestamps. j represents the sample index within the series.
	// By default, it injects j.
	TsFn func(ref, j int) int64
	// HistogramFn source histogram for histogram and float histogram records.
	// By default, newTestHist is used (exponential bucketing)
	HistogramFn func(ref int) *histogram.Histogram
	// NoST controls if ref samples should skip generating Start Timestamps. If true, ST is 0.
	NoST bool
}

RecordsCase represents record generation option in a form of a test case.

Generated Series will have refs that monotonic and deterministic, in range of [RefPadding, RefPadding+Series).

Jump to

Keyboard shortcuts

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