Open
Description
If next middle ware panics then m.ginMetricHandle
is not executed.
I known in this case response can not be correctly set, but at least can we count it and all correct metrics (client IP, lantency ...)
This can fix this case:
// monitorInterceptor as gin monitor middleware.
func (m *Monitor) monitorInterceptor(ctx *gin.Context) {
if ctx.Request.URL.Path != m.metricPath {
startTime := time.Now()
defer func() {
// after request
m.ginMetricHandle(ctx, startTime)
}()
}
// execute normal process.
ctx.Next()
}
Metadata
Metadata
Assignees
Labels
No labels