Skip to content

Instantly share code, notes, and snippets.

@rkhmelyuk
Last active February 18, 2018 03:29
Show Gist options
  • Save rkhmelyuk/a14a17ceb746cad4c713eb0d5c589e64 to your computer and use it in GitHub Desktop.
Save rkhmelyuk/a14a17ceb746cad4c713eb0d5c589e64 to your computer and use it in GitHub Desktop.
// Metrics handler collects status metrics.
func StatusMetrics() gin.HandlerFunc {
return func(c *gin.Context) {
statusCode := c.Writer.Status()
metrics.GetOrRegisterMeter("call."+getHandlerName(c)+".Status."+strconv.Itoa(statusCode), nil).Mark(1)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment