1
0
Fork 0
loadr/lib/types.go

42 lines
935 B
Go
Raw Normal View History

2024-12-04 16:40:52 -06:00
package lib
import (
"sync"
"time"
)
// PerformanceMetrics represents a thread-safe container for tracking
// performance statistics during load testing
2024-12-04 16:40:52 -06:00
type PerformanceMetrics struct {
Mu sync.Mutex
TotalRequests int32
TotalResponses int32
TotalLatency time.Duration
MaxLatency time.Duration
MinLatency time.Duration
ResponseCounters map[int]int32
2024-12-04 17:45:27 -06:00
RequestLatencies []RequestMetric
}
// RequestMetric represents a single request's performance metrics
type RequestMetric struct {
Timestamp time.Time
Duration time.Duration
StatusCode int
Verb string
2024-12-04 16:40:52 -06:00
}
// RequestError represents a detailed error that occurs during an HTTP request
2024-12-04 16:40:52 -06:00
type RequestError struct {
Verb string
URL string
Err error
}
// RequestPattern defines the characteristics of requests to be sent during load testing
2024-12-04 16:40:52 -06:00
type RequestPattern struct {
Verb string
Percentage float64
Sequence int
}