mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 17:42:12 +08:00
Chore: Fix staticcheck issues (#28860)
* Chore: Fix issues reported by staticcheck Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> * Undo changes Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> * Chore: Fix issues reported by staticcheck Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> * Fix test Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> * Fix test Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
@ -33,11 +33,11 @@ func Logger() macaron.Handler {
|
||||
rw := res.(macaron.ResponseWriter)
|
||||
c.Next()
|
||||
|
||||
timeTakenMs := time.Since(start) / time.Millisecond
|
||||
timeTaken := time.Since(start) / time.Millisecond
|
||||
|
||||
if timer, ok := c.Data["perfmon.timer"]; ok {
|
||||
timerTyped := timer.(prometheus.Summary)
|
||||
timerTyped.Observe(float64(timeTakenMs))
|
||||
timerTyped.Observe(float64(timeTaken))
|
||||
}
|
||||
|
||||
status := rw.Status()
|
||||
@ -50,9 +50,11 @@ func Logger() macaron.Handler {
|
||||
if ctx, ok := c.Data["ctx"]; ok {
|
||||
ctxTyped := ctx.(*models.ReqContext)
|
||||
if status == 500 {
|
||||
ctxTyped.Logger.Error("Request Completed", "method", req.Method, "path", req.URL.Path, "status", status, "remote_addr", c.RemoteAddr(), "time_ms", int64(timeTakenMs), "size", rw.Size(), "referer", req.Referer())
|
||||
ctxTyped.Logger.Error("Request Completed", "method", req.Method, "path", req.URL.Path, "status", status,
|
||||
"remote_addr", c.RemoteAddr(), "time_ms", int64(timeTaken), "size", rw.Size(), "referer", req.Referer())
|
||||
} else {
|
||||
ctxTyped.Logger.Info("Request Completed", "method", req.Method, "path", req.URL.Path, "status", status, "remote_addr", c.RemoteAddr(), "time_ms", int64(timeTakenMs), "size", rw.Size(), "referer", req.Referer())
|
||||
ctxTyped.Logger.Info("Request Completed", "method", req.Method, "path", req.URL.Path, "status", status,
|
||||
"remote_addr", c.RemoteAddr(), "time_ms", int64(timeTaken), "size", rw.Size(), "referer", req.Referer())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user