Documentation
¶
Index ¶
- type Data
- type ResponseWriter
- type Stats
- func (mw *Stats) Begin(w http.ResponseWriter) (time.Time, ResponseWriter)
- func (mw *Stats) Data() *Data
- func (mw *Stats) End(start time.Time, recorder ResponseWriter)
- func (mw *Stats) EndWithStatus(start time.Time, status int)
- func (mw *Stats) Handler(h http.Handler) http.Handler
- func (mw *Stats) ResetResponseCounts()
- func (mw *Stats) ServeHTTP(w http.ResponseWriter, r *http.Request, next http.HandlerFunc)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Data ¶
type Data struct { Pid int `json:"pid"` UpTime string `json:"uptime"` UpTimeSec float64 `json:"uptime_sec"` Time string `json:"time"` TimeUnix int64 `json:"unixtime"` StatusCodeCount map[string]int `json:"status_code_count"` TotalStatusCodeCount map[string]int `json:"total_status_code_count"` Count int `json:"count"` TotalCount int `json:"total_count"` TotalResponseTime string `json:"total_response_time"` TotalResponseTimeSec float64 `json:"total_response_time_sec"` AverageResponseTime string `json:"average_response_time"` AverageResponseTimeSec float64 `json:"average_response_time_sec"` }
Data serializable structure
type ResponseWriter ¶
type ResponseWriter interface { http.ResponseWriter http.Flusher // Status returns the status code of the response or 0 if the response has not been written. Status() int // Written returns whether or not the ResponseWriter has been written. Written() bool // Size returns the size of the response body. Size() int // Before allows for a function to be called before the ResponseWriter has been written to. This is // useful for setting headers or any other operations that must happen before a response has been written. Before(func(ResponseWriter)) }
func NewRecorderResponseWriter ¶
func NewRecorderResponseWriter(w http.ResponseWriter, statusCode int) ResponseWriter
type Stats ¶
type Stats struct { Uptime time.Time Pid int ResponseCounts map[string]int TotalResponseCounts map[string]int TotalResponseTime time.Time // contains filtered or unexported fields }
Stats data structure
func (*Stats) Begin ¶
func (mw *Stats) Begin(w http.ResponseWriter) (time.Time, ResponseWriter)
Begin starts a recorder
func (*Stats) End ¶
func (mw *Stats) End(start time.Time, recorder ResponseWriter)
End closes the recorder with the recorder status
func (*Stats) EndWithStatus ¶
EndWithStatus closes the recorder with a specific status
func (*Stats) ResetResponseCounts ¶
func (mw *Stats) ResetResponseCounts()
ResetResponseCounts reset the response counts
func (*Stats) ServeHTTP ¶
func (mw *Stats) ServeHTTP(w http.ResponseWriter, r *http.Request, next http.HandlerFunc)
Negroni compatible interface
Click to show internal directories.
Click to hide internal directories.