continuoustest

package
v0.0.0-...-fbfa8e9 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(cfg ClientConfig, logger log.Logger) (*Client, error)

func (*Client) Query

func (c *Client) Query(ctx context.Context, query string, ts time.Time, options ...RequestOption) (model.Vector, error)

Query implements MimirClient.

func (*Client) QueryRange

func (c *Client) QueryRange(ctx context.Context, query string, start, end time.Time, step time.Duration, options ...RequestOption) (model.Matrix, error)

QueryRange implements MimirClient.

func (*Client) WriteSeries

func (c *Client) WriteSeries(ctx context.Context, series []prompb.TimeSeries) (int, error)

WriteSeries implements MimirClient.

type ClientConfig

type ClientConfig struct {
	TenantID          string
	BasicAuthUser     string
	BasicAuthPassword string
	BearerToken       string

	WriteBaseEndpoint flagext.URLValue
	WriteBatchSize    int
	WriteTimeout      time.Duration
	WriteProtocol     string

	ReadBaseEndpoint flagext.URLValue
	ReadTimeout      time.Duration

	RequestDebug bool
	UserAgent    string
}

func (*ClientConfig) RegisterFlags

func (cfg *ClientConfig) RegisterFlags(f *flag.FlagSet)

type Config

type Config struct {
	Client              ClientConfig              `yaml:"-"`
	Manager             ManagerConfig             `yaml:"-"`
	WriteReadSeriesTest WriteReadSeriesTestConfig `yaml:"-"`
}

func (*Config) RegisterFlags

func (cfg *Config) RegisterFlags(f *flag.FlagSet)

type Manager

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

func NewManager

func NewManager(cfg ManagerConfig, logger log.Logger) *Manager

func (*Manager) AddTest

func (m *Manager) AddTest(t Test)

func (*Manager) Run

func (m *Manager) Run(ctx context.Context) error

type ManagerConfig

type ManagerConfig struct {
	SmokeTest   bool
	RunInterval time.Duration
}

func (*ManagerConfig) RegisterFlags

func (cfg *ManagerConfig) RegisterFlags(f *flag.FlagSet)

type MetricHistory

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

type MimirClient

type MimirClient interface {
	// WriteSeries writes input series to Mimir. Returns the response status code and optionally
	// an error. The error is always returned if request was not successful (eg. received a 4xx or 5xx error).
	WriteSeries(ctx context.Context, series []prompb.TimeSeries) (statusCode int, err error)

	// QueryRange performs a range query.
	QueryRange(ctx context.Context, query string, start, end time.Time, step time.Duration, options ...RequestOption) (model.Matrix, error)

	// Query performs an instant query.
	Query(ctx context.Context, query string, ts time.Time, options ...RequestOption) (model.Vector, error)
}

MimirClient is the interface implemented by a client used to interact with Mimir.

type RequestOption

type RequestOption func(options *requestOptions)

RequestOption defines a functional-style request option.

func WithResultsCacheEnabled

func WithResultsCacheEnabled(enabled bool) RequestOption

WithResultsCacheEnabled controls whether the query-frontend results cache should be enabled or disabled for the request. This function assumes query-frontend results cache is enabled by default.

type Test

type Test interface {
	// Name returns the test name. The name is used to uniquely identify the test in metrics and logs.
	Name() string

	// Init initializes the test. If the initialization fails, the testing tool will terminate.
	Init(ctx context.Context, now time.Time) error

	// Run runs a single test cycle. This function is called multiple times, at periodic intervals.
	// The returned error is ignored unless smoke-test is enabled. In that case, the error is returned to the caller.
	Run(ctx context.Context, now time.Time) error
}

type TestMetrics

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

TestMetrics holds generic metrics tracked by tests. The common metrics are used to enforce the same metric names and labels to track the same information across different tests.

func NewTestMetrics

func NewTestMetrics(testName string, reg prometheus.Registerer) *TestMetrics

func (*TestMetrics) InitializeCountersToZero

func (m *TestMetrics) InitializeCountersToZero(testType string)

type WriteReadSeriesTest

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

func (*WriteReadSeriesTest) Init

func (t *WriteReadSeriesTest) Init(ctx context.Context, now time.Time) error

Init implements Test.

func (*WriteReadSeriesTest) Name

func (t *WriteReadSeriesTest) Name() string

Name implements Test.

func (*WriteReadSeriesTest) Run

func (t *WriteReadSeriesTest) Run(ctx context.Context, now time.Time) error

Run implements Test.

func (*WriteReadSeriesTest) RunInner

func (t *WriteReadSeriesTest) RunInner(ctx context.Context, now time.Time, writeLimiter *rate.Limiter, errs *multierror.MultiError, metricName, typeLabel string, querySum querySumFunc, generateSeries generateSeriesFunc, generateValue generateValueFunc, generateSampleHistogram generateSampleHistogramFunc, records *MetricHistory)

type WriteReadSeriesTestConfig

type WriteReadSeriesTestConfig struct {
	NumSeries      int
	MaxQueryAge    time.Duration
	WithFloats     bool
	WithHistograms bool
}

func (*WriteReadSeriesTestConfig) RegisterFlags

func (cfg *WriteReadSeriesTestConfig) RegisterFlags(f *flag.FlagSet)

Jump to

Keyboard shortcuts

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