A robust Sentry client for Go applications
This library is a re-imagining of how Go applications should interact with a Sentry server. It aims to offer a concise, easy to understand and easy to extend toolkit for sending events to Sentry, with a strong emphasis on being easy to use.
- A beautiful API which makes it obvious exactly what the best way to solve a problem is.
- Comprehensive coverage of the various objects that can be sent to Sentry so you won't be left wondering why everyone else gets to play with Breadcrumbs but you still can't...
- StackTrace Support using the official
pkg/errors
stacktrace provider, for maximum compatibility and easy integration with other libraries. - HTTP Context Helpers to let you quickly expose HTTP request context as part of your errors - with optional support for sending cookies, headers and payload data.
- Extensive documentation which makes figuring out the right way to use something as easy as possible without the need to go diving into the code.
In addition to the features listed above, the library offers support for a number of more advanced use cases, including sending events to multiple different Sentry DSNs, derived client contexts, custom interface types and custom transports.
This package follows SemVer and uses gopkg.in to provide access to those versions.
-
sentry-go.v0 -
import ("gopkg.in/SierraSoftworks/sentry-go.v0")
This version is the latest
master
branch. You should avoid depending on this version unless you are performing active development againstsentry-go
. -
sentry-go.v1 -
import ("gopkg.in/SierraSoftworks/sentry-go.v1")
This version of
sentry-go
maintains API compatibility with the package's v1 API. If you usedsentry-go
for a project prior to 2019-09-25 then this is the version you should retain until you can update your code. It will receive bug and security fixes. -
sentry-go.v2 -
import ("gopkg.in/SierraSoftworks/sentry-go.v2")
This version is the most recent release of
sentry-go
and will maintain API compatibility. If you are creating a project that relies onsentry-go
then this is the version you should use.
package main
import (
"fmt"
"gopkg.in/SierraSoftworks/sentry-go.v2"
"github.com/pkg/errors"
)
func main() {
sentry.AddDefaultOptions(
sentry.DSN("..."), // If you don't override this, it'll be fetched from $SENTRY_DSN
sentry.Release("v1.0.0"),
)
cl := sentry.NewClient()
sentry.DefaultBreadcrumbs().NewDefault(nil).WithMessage("Application started").WithCategory("log")
err := errors.New("error with a stacktrace")
id := cl.Capture(
sentry.Message("Example exception submission to Sentry"),
sentry.ExceptionForError(err),
).Wait().E