Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrConnection is returned when the Recorder fails to connect to // the requested URL. ErrConnection = errors.New("connection error") // ErrCanceled is returned when the Recorder.Run context is canceled. ErrCanceled = errors.New("canceled") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Requests is the number of requests to send. Requests int // Concurrency is the maximum number of concurrent requests. Concurrency int // Interval is the minimum duration between two non-concurrent requests. Interval time.Duration // RequestTimeout is the timeout for each request sent. RequestTimeout time.Duration // GlobalTimeout is the timeout for the whole run. GlobalTimeout time.Duration // OnProgress is called each time the requester Progress is updated. // The requester Progress is updated each time a request is done, // and every second concurrently. OnProgress func(Progress) }
A Config determines the behavior of a Requester.
type Progress ¶
type Progress struct { Done bool Error error DoneCount, MaxCount int Timeout, Elapsed time.Duration }
Progress represents the progression of a recording at a given time.
type Record ¶
Record is the summary of a HTTP response. If Record.Error is not empty string, the HTTP call failed somewhere between sending the request to decoding the response body. In that cas invalidating the entire response, as it is not a remote server error.
type Recorder ¶
type Recorder struct {
// contains filtered or unexported fields
}
Recorder sends requests and records the results via the method Run. It must be initialized with New: it won't work otherwise.
Click to show internal directories.
Click to hide internal directories.