Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ReqEvent ¶
type ReqEvent struct { // Time is the time the request event happened. Time time.Time // Type is the type of the request event. Type ReqEventType // Key is the revision the event is associated with. // +optional Key types.NamespacedName }
ReqEvent represents either an incoming or closed request.
type ReqEventType ¶
type ReqEventType int
ReqEventType denotes the type (incoming/closed) of a ReqEvent.
const ( // ReqIn represents an incoming request ReqIn ReqEventType = iota // ReqOut represents a finished request ReqOut // ProxiedIn represents an incoming request through a proxy. ProxiedIn // ProxiedOut represents a finished proxied request. ProxiedOut )
type RequestStats ¶
type RequestStats struct {
// contains filtered or unexported fields
}
RequestStats collects statistics about requests as they flow in and out of the system.
func NewRequestStats ¶
func NewRequestStats(startedAt time.Time) *RequestStats
NewRequestStats builds a RequestStats instance, started at the given time.
func (*RequestStats) HandleEvent ¶
func (s *RequestStats) HandleEvent(event ReqEvent)
HandleEvent handles an incoming or outgoing request event and updates the state accordingly.
func (*RequestStats) Report ¶
func (s *RequestStats) Report(now time.Time) RequestStatsReport
Report returns a RequestStatsReport relative to the given time. The state will be reset for another reporting cycle afterwards.
type RequestStatsReport ¶
type RequestStatsReport struct { // AverageConcurrency is the average concurrency over the reporting timeframe. // This is calculated via the utilization at a given concurrency. For example: // 2 requests each taking 500ms over a 1s reporting window generate an average // concurrency of 1. AverageConcurrency float64 // AverageProxiedConcurrency is the average concurrency of all proxied requests. // The same calculation as above applies. AverageProxiedConcurrency float64 // RequestCount is the number of requests that arrived in the current reporting // timeframe. RequestCount float64 // ProxiedRequestCount is the number of proxied requests that arrived in the current // reporting timeframe. ProxiedRequestCount float64 }
RequestStatsReport are the metrics reported from the the request stats collector at a given time.
Click to show internal directories.
Click to hide internal directories.