Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use martini status_code_count and total_status_code_count code question, #22

Open
DavidYangNO1 opened this issue Nov 10, 2016 · 1 comment

Comments

@DavidYangNO1
Copy link

{
"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",
"total_response_time_sec": 0.078531534,
"average_response_time": "4.619502ms",
"average_response_time_sec": 0.004619502
}

status_code_count and total_status_code_count code always 200, reivew the code , it is hard-coded. so I think the statecode should be depend on w.
func (mw *Stats) Begin(w http.ResponseWriter) (time.Time, ResponseWriter) {
start := time.Now()

writer := NewRecorderResponseWriter(w, 200)

return start, writer

}

@adamtwiss
Copy link

I've just taken a look at this project, found the same problem and I agree with David. The hardcoded 200 at https://github.com/thoas/stats/blob/master/stats.go#L73 means that stats are only collected for 200.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants