Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetExtensions ¶
GetExtensions returns all registered extensions.
Types ¶
type Output ¶
type Output interface { // Returns a human-readable description of the output that will be shown in // `k6 run`. For extensions it probably should include the version as well. Description() string // Start is called before the Engine tries to use the output and should be // used for any long initialization tasks, as well as for starting a // goroutine to asynchronously flush metrics to the output. Start() error // A method to receive the latest metric samples from the Engine. This // method is never called concurrently, so do not do anything blocking here // that might take a long time. Preferably, just use the SampleBuffer or // something like it to buffer metrics until they are flushed. AddMetricSamples(samples []stats.SampleContainer) // Flush all remaining metrics and finalize the test run. Stop() error }
An Output abstracts the process of funneling samples to an external storage backend, such as a file or something like an InfluxDB instance.
N.B: All outputs should have non-blocking AddMetricSamples() methods and should spawn their own goroutine to flush metrics asynchronously.
type Params ¶
type Params struct { OutputType string // --out $OutputType=$ConfigArgument, K6_OUT="$OutputType=$ConfigArgument" ConfigArgument string JSONConfig json.RawMessage Logger logrus.FieldLogger Environment map[string]string StdOut io.Writer StdErr io.Writer FS afero.Fs ScriptPath *url.URL ScriptOptions lib.Options RuntimeOptions lib.RuntimeOptions ExecutionPlan []lib.ExecutionStep }
Params contains all possible constructor parameters an output may need.
type PeriodicFlusher ¶
type PeriodicFlusher struct {
// contains filtered or unexported fields
}
PeriodicFlusher is a small helper for asynchronously flushing buffered metric samples on regular intervals. The biggest benefit is having a Stop() method that waits for one last flush before it returns.
func NewPeriodicFlusher ¶
func NewPeriodicFlusher(period time.Duration, flushCallback func()) (*PeriodicFlusher, error)
NewPeriodicFlusher creates a new PeriodicFlusher and starts its goroutine.
func (*PeriodicFlusher) Stop ¶
func (pf *PeriodicFlusher) Stop()
Stop waits for the periodic flusher flush one last time and exit. You can safely call Stop() multiple times from different goroutines, you just can't call it from inside of the flushing function.
type SampleBuffer ¶
SampleBuffer is a simple thread-safe buffer for metric samples. It should be used by most outputs, since we generally want to flush metric samples to the remote service asynchronously. We want to do it only every several seconds, and we don't want to block the Engine in the meantime.
func (*SampleBuffer) AddMetricSamples ¶
func (sc *SampleBuffer) AddMetricSamples(samples []stats.SampleContainer)
AddMetricSamples adds the given metric samples to the internal buffer.
func (*SampleBuffer) GetBufferedSamples ¶
func (sc *SampleBuffer) GetBufferedSamples() []stats.SampleContainer
GetBufferedSamples returns the currently buffered metric samples and makes a new internal buffer with some hopefully realistic size. If the internal buffer is empty, it will return nil.
type WithRunStatusUpdates ¶
WithRunStatusUpdates means the output can receive test run status updates.
type WithTestRunStop ¶
WithTestRunStop is an output that can stop the Engine mid-test, interrupting the whole test run execution if some internal condition occurs, completely independently from the thresholds. It requires a callback function which expects an error and triggers the Engine to stop.
type WithThresholds ¶
type WithThresholds interface { Output SetThresholds(map[string]stats.Thresholds) }
WithThresholds is an output that requires the Engine to give it the thresholds before it can be started.