stats icon indicating copy to clipboard operation
stats copied to clipboard

A Go middleware that stores various information about your web application (response time, status code count, etc.)

Results 9 stats issues
Sort by recently updated
recently updated
newest added

Hi, I want to know it the result of `stats.Data()` has a format supported by Prometheus. Thanks

if we look at https://github.com/thoas/stats/blob/master/recorder.go#L39 and take following scenario: ``` func (r *recorderResponseWriter) WriteHeader(code int) { r.written = true r.ResponseWriter.WriteHeader(code) r.status = code } ``` 1. We write header 200....

https://github.com/thoas/stats/blob/master/stats.go#L33 Why reset the `ResponseCounts` every second? My team and I were using this value, banking on getting a total of status codes from this, but, after seeing this have...

{ "pid": 27613, "uptime": "2m7.358545583s", "uptime_sec": 127.358545583, "time": "2016-11-10 14:45:35.526270515 +0800 CST", "unixtime": 1478760335, "status_code_count": { "200": 1 }, "total_status_code_count": { "200": 17 }, "count": 1, "total_count": 17, "total_response_time": "78.531534ms",...

the example of gin should be: ``` go // StatMiddleware response time, status code count, etc. func StatMiddleware() gin.HandlerFunc { return func(c *gin.Context) { beginning, _ := Stats.Begin(c.Writer) c.Next() Stats.EndWithStatus(beginning,...

Looks like if you integrate with expvar https://golang.org/pkg/expvar/ (just publish the metrics there) then it would be very cross-compatible with a variety of other metric libraries

enhancement

It would be good if we could have the middleware not to record stats for the configured route that displays the /stats results. Presently, viewing the stats counts towards the...

enhancement