A sentry (raven-go) middleware for echo (v2) micro web framework.
Note: this support echo with the standard http engine (no fasthttp support yet)
echosentry.SetDSN("https://<key>:<secret>@app.getsentry.com/<project>")
e.Use(echosentry.Middleware())
By default, the middleware logs the HTTP context and sends it along with the stacktrace, this adds info about the user's browser, URL, OS, device, interface_type ..etc.
You can disable HTTP context as follow:
echosentry.WithContext(false)
You can append additional tags to be captured by Sentry. Tags content can be extracted from the current request context or just static tags, e.g. tags["app_version"] = appVersion.
echosentry.SetTags(func(c echo.Context) map[string]string {
return map[string]string{
"endpoint": c.Request().URL.String(),
"http_interface": c.Request().Proto,
"app_version": appVersion,
}
})
- Log the user info (user context)
- Expose more options
MIT License. A copy is included with the source.