Skip to content

01walid/echosentry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

echosentry

GoDoc

A sentry (raven-go) middleware for echo (v2) micro web framework.

Note: this support echo with the standard http engine (no fasthttp support yet)

Usage

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)

Additional tags

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,
    }
})

TODO

  • Log the user info (user context)
  • Expose more options

License

MIT License. A copy is included with the source.

Releases

No releases published

Packages

No packages published

Languages