engine

package
v0.38.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2022 License: AGPL-3.0 Imports: 9 Imported by: 6

Documentation

Overview

Package engine contains the internal metrics engine responsible for aggregating metrics during the test and evaluating thresholds against them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MetricsEngine

type MetricsEngine struct {

	// TODO: completely refactor:
	//   - make these private,
	//   - do not use an unnecessary map for the observed metrics
	//   - have one lock per metric instead of a a global one, when
	//     the metrics are decoupled from their types
	MetricsLock     sync.Mutex
	ObservedMetrics map[string]*metrics.Metric
	// contains filtered or unexported fields
}

MetricsEngine is the internal metrics engine that k6 uses to keep track of aggregated metric sample values. They are used to generate the end-of-test summary and to evaluate the test thresholds.

func NewMetricsEngine

func NewMetricsEngine(
	registry *metrics.Registry, executionState *lib.ExecutionState,
	opts lib.Options, rtOpts lib.RuntimeOptions, logger logrus.FieldLogger,
) (*MetricsEngine, error)

NewMetricsEngine creates a new metrics Engine with the given parameters.

func (*MetricsEngine) EvaluateThresholds

func (me *MetricsEngine) EvaluateThresholds() (thresholdsTainted, shouldAbort bool)

EvaluateThresholds processes all of the thresholds.

TODO: refactor, make private, optimize

func (*MetricsEngine) GetIngester

func (me *MetricsEngine) GetIngester() output.Output

GetIngester returns a pseudo-Output that uses the given metric samples to update the engine's inner state.

Jump to

Keyboard shortcuts

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