core

package
v0.31.1 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2021 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine struct {
	ExecutionScheduler lib.ExecutionScheduler

	Options lib.Options

	Metrics     map[string]*stats.Metric
	MetricsLock sync.Mutex

	Samples chan stats.SampleContainer
	// contains filtered or unexported fields
}

The Engine is the beating heart of k6.

func NewEngine

func NewEngine(
	ex lib.ExecutionScheduler, opts lib.Options, rtOpts lib.RuntimeOptions, outputs []output.Output, logger *logrus.Logger,
) (*Engine, error)

NewEngine instantiates a new Engine, without doing any heavy initialization.

func (*Engine) Init added in v0.27.0

func (e *Engine) Init(globalCtx, runCtx context.Context) (run func() error, wait func(), err error)

Init is used to initialize the execution scheduler and all metrics processing in the engine. The first is a costly operation, since it initializes all of the planned VUs and could potentially take a long time.

This method either returns an error immediately, or it returns test run() and wait() functions.

Things to note:

  • The first lambda, Run(), synchronously executes the actual load test.
  • It can be prematurely aborted by cancelling the runCtx - this won't stop the metrics collection by the Engine.
  • Stopping the metrics collection can be done at any time after Run() has returned by cancelling the globalCtx
  • The second returned lambda can be used to wait for that process to finish.

func (*Engine) IsStopped added in v0.27.0

func (e *Engine) IsStopped() bool

IsStopped returns a bool indicating whether the Engine has been stopped

func (*Engine) IsTainted

func (e *Engine) IsTainted() bool

func (*Engine) StartOutputs added in v0.31.0

func (e *Engine) StartOutputs() error

StartOutputs spins up all configured outputs, giving the thresholds to any that can accept them. And if some output fails, stop the already started ones. This may take some time, since some outputs make initial network requests to set up whatever remote services are going to listen to them.

TODO: this doesn't really need to be in the Engine, so take it out?

func (*Engine) Stop added in v0.27.0

func (e *Engine) Stop()

Stop closes a signal channel, forcing a running Engine to return

func (*Engine) StopOutputs added in v0.31.0

func (e *Engine) StopOutputs()

StopOutputs stops all configured outputs.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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