yardstick

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultRedirects is the default number of times an Attacker follows
	// redirects.
	DefaultRedirects = 10
	// DefaultTimeout is the default amount of time an Attacker waits for a request
	// before it times out.
	DefaultTimeout = 30 * time.Second
	// DefaultConnections is the default amount of max open idle connections per
	// target host.
	DefaultConnections = 10000
	// DefaultMaxConnections is the default amount of connections per target
	// host.
	DefaultMaxConnections = 0
	// DefaultWorkers is the default initial number of workers used to carry an attack.
	DefaultWorkers = 10
	// DefaultMaxWorkers is the default maximum number of workers used to carry an attack.
	DefaultMaxWorkers = math.MaxUint64
	// DefaultMaxBody is the default max number of bytes to be read from response bodies.
	// Defaults to no limit.
	DefaultMaxBody = int64(-1)
	// NoFollow is the value when redirects are not followed but marked successful
	NoFollow = -1
)

Variables

This section is empty.

Functions

func NewRate

func NewRate(frequency int, dur time.Duration) vegeta.Rate

Types

type Attacker

type Attacker struct {
	RequestFunc func(interface{}) (ResponseData, error)
	RequestData []interface{}
	Targeter    Targeter
	// contains filtered or unexported fields
}

TODO stolen straight outta Vegeta. Probably need to clean up some vestigial fields ... e.g. redirects?

func NewAttacker

func NewAttacker() *Attacker

func (*Attacker) AddRequestData

func (a *Attacker) AddRequestData(thing interface{})

func (*Attacker) Attack

func (a *Attacker) Attack(p vegeta.Pacer, du time.Duration, name string) <-chan *vegeta.Result

Attack reads its Targets from the passed Targeter and attacks them at the rate specified by the Pacer. When the duration is zero the attack runs until Stop is called. Results are sent to the returned channel as soon as they arrive and will have their Attack field set to the given name.

func (*Attacker) Stop

func (a *Attacker) Stop()

Stop stops the current attack.

type Metrics

type Metrics = vegeta.Metrics

type ResponseData

type ResponseData struct {
	Code     uint16
	BytesIn  uint64
	BytesOut uint64
}

type Targeter

type Targeter func(*interface{}) error

Targeting, or how to get the RequestData into the RequestFunc for the attack.

func NewStaticTargeter

func NewStaticTargeter(tgts ...interface{}) Targeter

type YMetrics

type YMetrics struct {
	// contains filtered or unexported fields
}

func NewMetrics

func NewMetrics(successCodes []uint16) *YMetrics

Define your own set of success codes

func NewMetricsWithDefaults

func NewMetricsWithDefaults() *YMetrics

Default is 0 = success, everything else is failure.

func (*YMetrics) Add

func (o *YMetrics) Add(r *vegeta.Result)

func (*YMetrics) Close

func (o *YMetrics) Close()

func (*YMetrics) Get

func (o *YMetrics) Get() Metrics

Jump to

Keyboard shortcuts

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