Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type StatRecorder ¶
func (*StatRecorder) AddResponse ¶
func (t *StatRecorder) AddResponse(responseTime time.Duration, statusCode int)
func (*StatRecorder) GetStat ¶
func (t *StatRecorder) GetStat() TargetStats
type StatServer ¶
type StatServer struct {
// contains filtered or unexported fields
}
func NewStatServer ¶
func NewStatServer(opts ...StatServerOption) *StatServer
func (*StatServer) ListenAndServe ¶
func (s *StatServer) ListenAndServe() error
func (*StatServer) PostRequest ¶
func (*StatServer) PreRequest ¶
func (*StatServer) RegisterTarget ¶
func (s *StatServer) RegisterTarget(target proxy.Target)
type StatServerOption ¶
type StatServerOption func(*StatServer)
func WithCaptureWindow ¶
func WithCaptureWindow(window time.Duration) StatServerOption
func WithPort ¶
func WithPort(port int) StatServerOption
type TargetStats ¶
type TargetStats struct { StatStartDate time.Time `json:"statStartDate"` // the total number of requests TotalRequestCount int `json:"totalRequestCount"` // average response time TotalAvgResponseTime time.Duration `json:"totalAvgResponseTime"` // the time window to base the stats on // e.g. 1 minute would capture the responses of the last minute to calculate the stats WindowDuration time.Duration `json:"windowDuration"` // the average response time in the window duration AvgResponseTime time.Duration `json:"avgResponseTime"` // the number of requests in the window duration RequestCount int `json:"requestCount"` // the number of requests per second in the window duration RequestRate float64 `json:"requestRate"` // the number of requests that failed (Status >= 400) in the window duration ErrorRate float64 `json:"errorRate"` }
Click to show internal directories.
Click to hide internal directories.