An open API service indexing awesome lists of open source software.

https://github.com/01walid/echosentry

A sentry (raven-go) middleware for echo micro web framework
https://github.com/01walid/echosentry

echo error-log error-monitoring error-reporting golang middleware raven sentry sentry-client

Last synced: 5 months ago
JSON representation

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

Awesome Lists containing this project

README

          

# echosentry
[![GoDoc](https://godoc.org/github.com/01walid/echosentry?status.svg)](https://godoc.org/github.com/01walid/echosentry)

A sentry ([raven-go](https://github.com/getsentry/raven-go)) middleware for [echo](https://github.com/labstack/echo) (v2) micro web framework.

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

# Usage

```go
echosentry.SetDSN("https://:@app.getsentry.com/")
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:

```go
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.

```go
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.