Documentation
      ¶
    
    
  
    
  
    Index ¶
- Variables
 - func AnonymizePath(path string) string
 - func Clampf(val, min, max float64) float64
 - func Lerp(x, y int64, t float64) int64
 - func Max(a, b int64) int64
 - func Min(a, b int64) int64
 - func SplitKV(s string) (key, value string)
 - type Archive
 - type AtomicBool
 - type AuthenticatedCollector
 - type Check
 - type Collector
 - type Duration
 - type Executor
 - type Group
 - type NullDuration
 - type Options
 - type Runner
 - type RunnerFunc
 - type RunnerFuncVU
 - type SourceData
 - type Stage
 - type StageFields
 - type TLSAuth
 - type TLSAuthFields
 - type TLSCipherSuites
 - type TLSVersion
 - type VU
 
Constants ¶
This section is empty.
Variables ¶
var ErrNameContainsGroupSeparator = errors.Errorf("group and check names may not contain '%s'", groupSeparator)
    var SupportedTLSCipherSuites = map[string]uint16{ "TLS_RSA_WITH_RC4_128_SHA": tls.TLS_RSA_WITH_RC4_128_SHA, "TLS_RSA_WITH_3DES_EDE_CBC_SHA": tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA, "TLS_RSA_WITH_AES_128_CBC_SHA": tls.TLS_RSA_WITH_AES_128_CBC_SHA, "TLS_RSA_WITH_AES_256_CBC_SHA": tls.TLS_RSA_WITH_AES_256_CBC_SHA, "TLS_RSA_WITH_AES_128_GCM_SHA256": tls.TLS_RSA_WITH_AES_128_GCM_SHA256, "TLS_RSA_WITH_AES_256_GCM_SHA384": tls.TLS_RSA_WITH_AES_256_GCM_SHA384, "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA": tls.TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA": tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA": tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, "TLS_ECDHE_RSA_WITH_RC4_128_SHA": tls.TLS_ECDHE_RSA_WITH_RC4_128_SHA, "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA": tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA": tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA": tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256": tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256": tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384": tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384": tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, }
var SupportedTLSCipherSuitesToString = map[uint16]string{ tls.TLS_RSA_WITH_RC4_128_SHA: "TLS_RSA_WITH_RC4_128_SHA", tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA: "TLS_RSA_WITH_3DES_EDE_CBC_SHA", tls.TLS_RSA_WITH_AES_128_CBC_SHA: "TLS_RSA_WITH_AES_128_CBC_SHA", tls.TLS_RSA_WITH_AES_256_CBC_SHA: "TLS_RSA_WITH_AES_256_CBC_SHA", tls.TLS_RSA_WITH_AES_128_GCM_SHA256: "TLS_RSA_WITH_AES_128_GCM_SHA256", tls.TLS_RSA_WITH_AES_256_GCM_SHA384: "TLS_RSA_WITH_AES_256_GCM_SHA384", tls.TLS_ECDHE_ECDSA_WITH_RC4_128_SHA: "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA", tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA: "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA", tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA: "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA", tls.TLS_ECDHE_RSA_WITH_RC4_128_SHA: "TLS_ECDHE_RSA_WITH_RC4_128_SHA", tls.TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA: "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA", tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA: "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA", tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA: "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA", tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256: "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256: "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256", tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384: "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384", tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384: "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", }
var SupportedTLSVersions = map[string]int{ "ssl3.0": tls.VersionSSL30, "tls1.0": tls.VersionTLS10, "tls1.1": tls.VersionTLS11, "tls1.2": tls.VersionTLS12, }
Functions ¶
func AnonymizePath ¶ added in v0.15.0
Archives should be share-able; to that end, paths including home directories should be anonymized.
Types ¶
type Archive ¶ added in v0.15.0
type Archive struct {
	// The runner to use, eg. "js".
	Type string `json:"type"`
	// Options to use.
	Options Options `json:"options"`
	// Filename and contents of the main file being executed.
	Filename string `json:"filename"`
	Data     []byte `json:"-"`
	// Working directory for resolving relative paths.
	Pwd string `json:"pwd"`
	// Archived filesystem.
	Scripts map[string][]byte `json:"-"` // included scripts
	Files   map[string][]byte `json:"-"` // non-script resources
}
    An Archive is a rollup of all resources and options needed to reproduce a test identically elsewhere.
type AtomicBool ¶ added in v0.17.0
type AtomicBool struct {
	// contains filtered or unexported fields
}
    func (*AtomicBool) Get ¶ added in v0.17.0
func (a *AtomicBool) Get() bool
func (*AtomicBool) Set ¶ added in v0.17.0
func (a *AtomicBool) Set(v bool)
type AuthenticatedCollector ¶ added in v0.16.0
type AuthenticatedCollector interface {
	Collector
	// Present a login form to the user.
	Login(conf interface{}, in io.Reader, out io.Writer) (interface{}, error)
}
    An AuthenticatedCollector is a collector that can store persistent authentication.
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().
	// You should do any lenghty setup here rather than in New.
	Init() error
	// 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)
	// Optionally return a link that is shown to the user.
	Link() string
}
    A Collector abstracts away the details of a storage backend from the application.
type Duration ¶ added in v0.9.2
func (Duration) MarshalJSON ¶ added in v0.16.0
func (*Duration) UnmarshalJSON ¶ added in v0.9.2
func (*Duration) UnmarshalText ¶ added in v0.18.0
type Executor ¶ added in v0.17.0
type Executor interface {
	Run(ctx context.Context, out chan<- []stats.Sample) error
	IsRunning() bool
	GetRunner() Runner
	SetLogger(l *log.Logger)
	GetLogger() *log.Logger
	GetStages() []Stage
	SetStages(s []Stage)
	GetIterations() int64
	GetEndIterations() null.Int
	SetEndIterations(i null.Int)
	GetTime() time.Duration
	GetEndTime() NullDuration
	SetEndTime(t NullDuration)
	IsPaused() bool
	SetPaused(paused bool)
	GetVUs() int64
	SetVUs(vus int64) error
	GetVUsMax() int64
	SetVUsMax(max int64) error
}
    An Executor wraps a Runner, and abstracts away an execution environment.
type Group ¶
type NullDuration ¶ added in v0.16.0
func NullDurationFrom ¶ added in v0.16.0
func NullDurationFrom(d time.Duration) NullDuration
func (NullDuration) MarshalJSON ¶ added in v0.16.0
func (d NullDuration) MarshalJSON() ([]byte, error)
func (*NullDuration) UnmarshalJSON ¶ added in v0.16.0
func (d *NullDuration) UnmarshalJSON(data []byte) error
func (*NullDuration) UnmarshalText ¶ added in v0.18.0
func (d *NullDuration) UnmarshalText(data []byte) error
type Options ¶
type Options struct {
	Paused     null.Bool    `json:"paused" envconfig:"paused"`
	VUs        null.Int     `json:"vus" envconfig:"vus"`
	VUsMax     null.Int     `json:"vusMax" envconfig:"vus_max"`
	Duration   NullDuration `json:"duration" envconfig:"duration"`
	Iterations null.Int     `json:"iterations" envconfig:"iterations"`
	Stages     []Stage      `json:"stages" envconfig:"stages"`
	Linger        null.Bool `json:"linger" ignored:"true"`        // DEPRECATED; will be removed.
	NoUsageReport null.Bool `json:"noUsageReport" ignored:"true"` // DEPRECATED; will be moved to cli config.
	MaxRedirects          null.Int         `json:"maxRedirects" envconfig:"max_redirects"`
	InsecureSkipTLSVerify null.Bool        `json:"insecureSkipTLSVerify" envconfig:"insecure_skip_tls_verify"`
	TLSCipherSuites       *TLSCipherSuites `json:"tlsCipherSuites" envconfig:"tls_cipher_suites"`
	TLSVersion            *TLSVersion      `json:"tlsVersion" envconfig:"tls_version"`
	TLSAuth               []*TLSAuth       `json:"tlsAuth" envconfig:"tlsauth"`
	NoConnectionReuse     null.Bool        `json:"noConnectionReuse" envconfig:"no_connection_reuse"`
	UserAgent             null.String      `json:"userAgent" envconfig:"user_agent"`
	Throw                 null.Bool        `json:"throw" envconfig:"throw"`
	Thresholds map[string]stats.Thresholds `json:"thresholds" envconfig:"thresholds"`
	// These values are for third party collectors' benefit.
	// Can't be set through env vars.
	External map[string]interface{} `json:"ext" ignored:"true"`
}
    type Runner ¶
type Runner interface {
	// Archives the runner; an archive can be restored anywhere else to create a perfect clone.
	MakeArchive() *Archive
	// 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
	// Sets the option set.
	SetOptions(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) 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) MakeArchive ¶ added in v0.15.0
func (fn RunnerFunc) MakeArchive() *Archive
func (RunnerFunc) NewVU ¶ added in v0.5.0
func (fn RunnerFunc) NewVU() (VU, error)
func (RunnerFunc) SetOptions ¶ added in v0.18.1
func (fn RunnerFunc) SetOptions(opts Options)
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 ¶
type Stage StageFields
func (Stage) MarshalJSON ¶ added in v0.18.0
func (*Stage) UnmarshalJSON ¶ added in v0.9.2
For some reason, implementing UnmarshalText makes encoding/json treat the type as a string.
func (*Stage) UnmarshalText ¶ added in v0.18.0
type StageFields ¶ added in v0.18.0
type StageFields struct {
	Duration NullDuration `json:"duration"`
	Target   null.Int     `json:"target"`
}
    type TLSAuth ¶ added in v0.17.2
type TLSAuth struct {
	TLSAuthFields
	// contains filtered or unexported fields
}
    func (*TLSAuth) Certificate ¶ added in v0.17.2
func (c *TLSAuth) Certificate() (*tls.Certificate, error)
func (*TLSAuth) UnmarshalJSON ¶ added in v0.17.2
type TLSAuthFields ¶ added in v0.17.2
type TLSCipherSuites ¶ added in v0.17.0
type TLSCipherSuites []uint16
func (*TLSCipherSuites) UnmarshalJSON ¶ added in v0.17.0
func (s *TLSCipherSuites) UnmarshalJSON(data []byte) error
type TLSVersion ¶ added in v0.17.0
func (*TLSVersion) UnmarshalJSON ¶ added in v0.17.0
func (v *TLSVersion) UnmarshalJSON(data []byte) error
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.