Documentation
¶
Index ¶
- Constants
- Variables
- func Clampf(val, min, max float64) float64
- func Lerp(x, y int64, t float64) int64
- func SplitKV(s string) (key, value string)
- type Check
- type Collector
- type CookieJar
- type Duration
- type Engine
- func (e *Engine) AtTime() time.Duration
- func (e *Engine) GetVUs() int64
- func (e *Engine) GetVUsMax() int64
- func (e *Engine) IsPaused() bool
- func (e *Engine) IsRunning() bool
- func (e *Engine) IsTainted() bool
- func (e *Engine) Run(ctx context.Context) error
- func (e *Engine) SetPaused(v bool)
- func (e *Engine) SetVUs(v int64) error
- func (e *Engine) SetVUsMax(v int64) error
- func (e *Engine) TotalTime() time.Duration
- type Group
- type Options
- type Runner
- type RunnerFunc
- type RunnerFuncVU
- type SourceData
- type Stage
- type VU
Constants ¶
View Source
const ( TickRate = 1 * time.Millisecond MetricsRate = 1 * time.Second CollectRate = 10 * time.Millisecond ThresholdsRate = 2 * time.Second ShutdownTimeout = 10 * time.Second BackoffAmount = 50 * time.Millisecond BackoffMax = 10 * time.Second )
Variables ¶
View Source
var ErrNameContainsGroupSeparator = errors.Errorf("group and check names may not contain '%s'", groupSeparator)
Functions ¶
Types ¶
type Check ¶
type Collector ¶ added in v0.8.3
type Collector interface {
// Init is called between the collector's creation and the call to Run(), right after the k6
// banner has been printed to stdout.
Init()
// Run is called in a goroutine and starts the collector. Should commit samples to the backend
// at regular intervals and when the context is terminated.
Run(ctx context.Context)
// Collect receives a set of samples. This method is never called concurrently, and only while
// the context for Run() is valid, but should defer as much work as possible to Run().
Collect(samples []stats.Sample)
}
A Collector abstracts away the details of a storage backend from the application.
type CookieJar ¶
type CookieJar struct {
// contains filtered or unexported fields
}
CookieJar implements a simplified version of net/http/cookiejar, that most notably can be cleared without reinstancing the whole thing.
func NewCookieJar ¶
func NewCookieJar() *CookieJar
type Duration ¶ added in v0.9.2
func (*Duration) UnmarshalJSON ¶ added in v0.9.2
type Engine ¶
type Engine struct {
Runner Runner
Options Options
Collector Collector
Logger *log.Logger
Stages []Stage
Metrics map[string]*stats.Metric
MetricsLock sync.RWMutex
// contains filtered or unexported fields
}
The Engine is the beating heart of K6.
type Group ¶
type Options ¶
type Options struct {
Paused null.Bool `json:"paused"`
VUs null.Int `json:"vus"`
VUsMax null.Int `json:"vusMax"`
Duration null.String `json:"duration"`
Iterations null.Int `json:"iterations"`
Stages []Stage `json:"stages"`
Linger null.Bool `json:"linger"`
NoUsageReport null.Bool `json:"noUsageReport"`
MaxRedirects null.Int `json:"maxRedirects"`
InsecureSkipTLSVerify null.Bool `json:"insecureSkipTLSVerify"`
NoConnectionReuse null.Bool `json:"noConnectionReuse"`
Thresholds map[string]stats.Thresholds `json:"thresholds"`
// These values are for third party collectors' benefit.
External map[string]interface{} `json:"ext"`
}
func (Options) SetAllValid ¶
type Runner ¶
type Runner interface {
// Creates a new VU. As much as possible should be precomputed here, to allow a pool
// of prepared VUs to be used to quickly scale up and down.
NewVU() (VU, error)
// Returns the default (root) group.
GetDefaultGroup() *Group
// Returns the option set.
GetOptions() Options
// Applies a set of options.
ApplyOptions(opts Options)
}
A Runner is a factory for VUs.
type RunnerFunc ¶ added in v0.5.0
RunnerFunc adapts a function to be used as both a runner and a VU. Mainly useful for testing.
func (RunnerFunc) ApplyOptions ¶ added in v0.5.0
func (fn RunnerFunc) ApplyOptions(opts Options)
func (RunnerFunc) GetDefaultGroup ¶ added in v0.5.0
func (fn RunnerFunc) GetDefaultGroup() *Group
func (RunnerFunc) GetOptions ¶ added in v0.5.0
func (fn RunnerFunc) GetOptions() Options
func (RunnerFunc) NewVU ¶ added in v0.5.0
func (fn RunnerFunc) NewVU() (VU, error)
func (RunnerFunc) VU ¶ added in v0.11.0
func (fn RunnerFunc) VU() *RunnerFuncVU
type RunnerFuncVU ¶ added in v0.11.0
type RunnerFuncVU struct {
Fn RunnerFunc
ID int64
}
func (*RunnerFuncVU) Reconfigure ¶ added in v0.11.0
func (fn *RunnerFuncVU) Reconfigure(id int64) error
type SourceData ¶ added in v0.9.0
type Stage ¶
func (*Stage) UnmarshalJSON ¶ added in v0.9.2
type VU ¶
type VU interface {
// Runs the VU once. An iteration should be completely self-contained, and no state
// or open connections should carry over from one iteration to the next.
RunOnce(ctx context.Context) ([]stats.Sample, error)
// Called when the VU's identity changes.
Reconfigure(id int64) error
}
A VU is a Virtual User.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.