testsupport

package
v0.0.0-...-6ee8545 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSampleIngestor

func NewSampleIngestor(shards int, samples PromIterator, batchSize int, sampleRate int) *sampleIngestor

NewSampleIngestor creates sampleIngestor responsible for splitting samples into shards and sending them down the ingestion path zero sampleRate means no limits

func NewSeriesGenerator

func NewSeriesGenerator(numMetrics, numSeriesPerMetric, labels int) (*seriesGen, error)

NewSeriesGenerator generates distinct timeseries equal to numMetrics * numSeriesPerMetric, such that each timeseries has `labels` count of labels. The label keys are common across the series, but their values are random, thereby creating a new series.

Types

type BlockSample

type BlockSample struct {
	// contains filtered or unexported fields
}

Sample loaded from Prometheus block

type IngestFunc

type IngestFunc func(context.Context, *prompb.WriteRequest) (uint64, uint64, error)

type MockBatch

type MockBatch struct{}

func (MockBatch) Len

func (MockBatch) Len() int

func (MockBatch) Queue

func (MockBatch) Queue(query string, arguments ...any) *pgx.QueuedQuery

type MockBatchResults

type MockBatchResults struct{}

func (MockBatchResults) Close

func (MockBatchResults) Close() error

func (MockBatchResults) Exec

func (MockBatchResults) Query

func (MockBatchResults) Query() (pgx.Rows, error)

func (MockBatchResults) QueryRow

func (MockBatchResults) QueryRow() pgx.Row

type MockPgxConn

type MockPgxConn struct{}

func (MockPgxConn) Acquire

func (MockPgxConn) Acquire(ctx context.Context) (*pgxpool.Conn, error)

func (MockPgxConn) BeginTx

func (MockPgxConn) BeginTx(ctx context.Context) (pgx.Tx, error)

func (MockPgxConn) Close

func (MockPgxConn) Close()

func (MockPgxConn) CopyFrom

func (MockPgxConn) CopyFrom(
	ctx context.Context,
	tx pgx.Tx,
	tableName pgx.Identifier,
	columnNames []string,
	rowSrc pgx.CopyFromSource,
	oids []uint32,
) (int64, error)

func (MockPgxConn) CopyFromRows

func (MockPgxConn) CopyFromRows(rows [][]interface{}) pgx.CopyFromSource

func (MockPgxConn) Exec

func (MockPgxConn) Exec(ctx context.Context, sql string, arguments ...interface{}) (pgconn.CommandTag, error)

func (MockPgxConn) NewBatch

func (MockPgxConn) NewBatch() pgxconn.PgxBatch

func (MockPgxConn) Query

func (MockPgxConn) Query(ctx context.Context, sql string, args ...interface{}) (pgxconn.PgxRows, error)

func (MockPgxConn) QueryRow

func (MockPgxConn) QueryRow(ctx context.Context, sql string, args ...interface{}) pgx.Row

func (MockPgxConn) SendBatch

func (MockPgxConn) SendBatch(ctx context.Context, b pgxconn.PgxBatch) (pgx.BatchResults, error)

type MockRow

type MockRow struct{}

func (MockRow) Scan

func (MockRow) Scan(dest ...interface{}) error

type PromIterator

type PromIterator interface {
	Next() bool
	Get() TimeSeries
}

PromIterator allows us to iterate over Prometheus data

type PromLoader

type PromLoader interface {
	Iterator() PromIterator
	Close() error
}

PromLoader is responsible for loading Prometheus data files and providing iterator over Prometheus data

func NewPromLoader

func NewPromLoader(dataDir string, inMemory bool) (PromLoader, error)

PromLoader can preload the whole dataset in memory which can be useful to get accurate memory allocations when benchmarking. However it does mean that bench test needs more memory to run so make sure that test dataset can fit into memory

type TimeSeries

type TimeSeries struct {
	Val prompb.TimeSeries
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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