Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PerfTestHTTP2CMD ¶
PerfTestHTTP2CMD creates a new cobra.Command for HTTP/2 performance test.
func PerfTestHTTP3CMD ¶
PerfTestHTTP3CMD creates a new cobra.Command for HTTP/3 performance test.
func PerfTestHTTPCMD ¶
PerfTestHTTPCMD creates a new cobra.Command for HTTP/1.1 performance test.
Types ¶
type HTTPReqParams ¶
type PerfTestHTTP ¶
type PerfTestHTTP struct {
ID int64 // performance test ID
Client *http.Client
Params *HTTPReqParams
Worker int
TotalRequests uint64
Duration time.Duration
PushURL string
PrometheusJobName string
}
PerfTestHTTP performance test parameters for HTTP
func (*PerfTestHTTP) RunWithFixedDuration ¶
func (p *PerfTestHTTP) RunWithFixedDuration() (*Statistics, error)
RunWithFixedDuration implements performance with a fixed duration.
func (*PerfTestHTTP) RunWithFixedRequestsNum ¶
func (p *PerfTestHTTP) RunWithFixedRequestsNum() (*Statistics, error)
RunWithFixedRequestsNum implements performance with a fixed number of requests.
type Statistics ¶
type Statistics struct {
PerfTestID int64 `json:"perf_test_id"` // Performance Test ID
URL string `json:"url"` // performed request URL
Method string `json:"method"` // request method
Body string `json:"body"` // request body (JSON)
TotalRequests uint64 `json:"total_requests"` // total requests
TotalDuration float64 `json:"total_duration"` // total duration (seconds)
SuccessCount uint64 `json:"success_count"` // successful requests (status code 2xx)
ErrorCount uint64 `json:"error_count"` // failed requests (status code not 2xx)
Errors []string `json:"errors"` // error details
QPS float64 `json:"qps"` // requests per second (Throughput)
AvgLatency float64 `json:"avg_latency"` // average latency (ms)
P25Latency float64 `json:"p25_latency"` // 25th percentile latency (ms)
P50Latency float64 `json:"p50_latency"` // 50th percentile latency (ms)
P95Latency float64 `json:"p95_latency"` // 95th percentile latency (ms)
MinLatency float64 `json:"min_latency"` // minimum latency (ms)
MaxLatency float64 `json:"max_latency"` // maximum latency (ms)
TotalSent int64 `json:"total_sent"` // total sent (bytes)
TotalReceived int64 `json:"total_received"` // total received (bytes)
StatusCodes map[int]int64 `json:"status_codes"` // status code distribution (count)
CreatedAt time.Time `json:"created_at"` // created time
}
Statistics statistical data
func (*Statistics) Save ¶
func (s *Statistics) Save(filePath string) error
Save saves the statistics data to a JSON file.
Click to show internal directories.
Click to hide internal directories.