Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrintReport ¶
func PrintReport(r RunReport)
PrintReport writes the JSON report to a file or stdout, depending on the configuration.
func PrintSummary ¶
func PrintSummary(r RunReport)
PrintSummary logs a subset of the report for each metric label
Types ¶
type Attack ¶
type Attack interface { // Setup should establish the connection to the service // It may want to access the config of the runner. Setup(c Config) error // Do performs one request and is executed in a separate goroutine. // The context is used to cancel the request on timeout. Do(ctx context.Context) DoResult // Teardown can be used to close the connection to the service Teardown() error // Clone should return a fresh new Attack // Make sure the new Attack has values for shared struct fields initialized at Setup. Clone() Attack }
Attack must be implemented by a service client.
type Config ¶
type Config struct { RPS int `json:"rps"` AttackTimeSec int `json:"attackTimeSec"` RampupTimeSec int `json:"rampupTimeSec"` RampupStrategy string `json:"rampupStrategy"` MaxAttackers int `json:"maxAttackers"` OutputFilename string `json:"outputFilename,omitempty"` Verbose bool `json:"verbose"` Metadata map[string]string `json:"metadata,omitempty"` DoTimeoutSec int `json:"doTimeoutSec"` }
Config holds settings for a Runner.
func ConfigFromFile ¶
ConfigFromFile loads a Config for use in a runner.
func ConfigFromFlags ¶
func ConfigFromFlags() Config
ConfigFromFlags creates a Config for use in a runner.
type DoResult ¶
type DoResult struct { // Label identifying the request that was send which is only used for reporting the metrics. RequestLabel string // The error that happened when sending the request or receiving the response. Error error // The HTTP status code. StatusCode int // Number of bytes transferred when sending the request. BytesIn int64 // Number of bytes transferred when receiving the response. BytesOut int64 }
DoResult is the return value of a Do call on an Attack.
type LatencyMetrics ¶
type LatencyMetrics struct { // Total is the total latency sum of all requests in an attack. Total time.Duration `json:"total"` // Mean is the mean request latency. Mean time.Duration `json:"mean"` // P50 is the 50th percentile request latency. P50 time.Duration `json:"50th"` // P95 is the 95th percentile request latency. P95 time.Duration `json:"95th"` // P99 is the 99th percentile request latency. P99 time.Duration `json:"99th"` // Max is the maximum observed request latency. Max time.Duration `json:"max"` }
LatencyMetrics holds computed request latency metrics.
type Metrics ¶
type Metrics struct { // Latencies holds computed request latency metrics. Latencies LatencyMetrics `json:"latencies"` // First is the earliest timestamp in a Result set. Earliest time.Time `json:"earliest"` // Latest is the latest timestamp in a Result set. Latest time.Time `json:"latest"` // End is the latest timestamp in a Result set plus its latency. End time.Time `json:"end"` // Duration is the duration of the attack. Duration time.Duration `json:"duration"` // Wait is the extra time waiting for responses from targets. Wait time.Duration `json:"wait"` // Requests is the total number of requests executed. Requests uint64 `json:"requests"` // Rate is the rate of requests per second. Rate float64 `json:"rate"` // Success is the percentage of non-error responses. Success float64 `json:"success"` // StatusCodes is a histogram of the responses' status codes. StatusCodes map[string]int `json:"status_codes"` // Errors is a set of unique errors returned by the targets during the attack. Errors []string `json:"errors"` // contains filtered or unexported fields }
Metrics holds metrics computed out of a slice of Results which are used in some of the Reporters
type RunReport ¶
type RunReport struct { StartedAt time.Time `json:"startedAt"` FinishedAt time.Time `json:"finishedAt"` Configuration Config `json:"configuration"` // RunError is set when a Run could not be called or executed. RunError string `json:"runError"` Metrics map[string]*Metrics `json:"metrics"` // Failed can be set by your load test program to indicate that the results are not acceptable. Failed bool `json:"failed"` // Output is used to publish any custom output in the report. Output map[string]interface{} `json:"output"` }
RunReport is a composition of configuration, measurements and custom output from a load run.
func NewErrorReport ¶
NewErrorReport returns a report when a Run could not be called or executed.
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
grpc
Package main is a generated protocol buffer package.
|
Package main is a generated protocol buffer package. |
grpc/server
Package main is a generated protocol buffer package.
|
Package main is a generated protocol buffer package. |