Documentation ¶
Index ¶
Constants ¶
const ( // DefaultBufferSize is buf size sampling response time for percentile and average. DefaultBufferSize = 1000 // DefaultSamplingFactor is factor to sample response time for percentile and average DefaultSamplingFactor = 1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Data ¶
type Data struct { Request RequestData `json:"request"` Response ResponseData `json:"response"` }
Data is a metrics data.
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
Metrics is a HTTP metrics structure. a Metrics measures only one http.Handler. Metrics is needed to the number of http.Handler which you want to measure.
Metrics has buffer for measuring latest HTTP requests. default bufsize is DefaultBufferSize. if you want to modify, use NewCapa().
func New ¶
New returns a new statistics structure. buffer size of HTTP requests is allocated length of DefaultBufferSize.
func NewCapa ¶
NewCapa returns a new statistics structure. buffer size of HTTP requests is allocated length of bufsize.
if bufsize is less than 2, NewCapa returns error.
type RequestData ¶
type RequestData struct { // Count is sum of all HTTP request counts. Count int64 `json:"count"` // StatusCount is HTTP request count for each HTTP status. StatusCount statusCountMap `json:"status_count"` }
RequestData is metrics of HTTP request.
type ResponseData ¶
type ResponseData struct { // MaxTime is maximum response time in a period. MaxTime float64 `json:"max_time"` // MinTime is minimum response time in a period. MinTime float64 `json:"min_time"` // AverageTime is average HTTP response time of HTTP requests in buffer. AverageTime float64 `json:"average_time"` // PercentiledTime is HTTP response time percentiles of latest bufsize HTTP requests. PercentiledTime percentiledTimeMap `json:"percentiled_time"` }
ResponseData is metrics of HTTP response.