Migrate to sentry-go
2 unresolved threads
2 unresolved threads
Compare changes
The github.com/getsentry/raven-go
was deprecated in favor of
github.com/getsentry/sentry-go
. Update the dependency to the latest
a version of github.com/getsentry/sentry-go
and remove raven-go
as a
dependency, following the migration
guide.
This update does not break any downstream clients to keep backward compatibility.
We cannot completely remove the raven-go
dependency since we have
correlation/raven
package (deprecated) that exposes
raven specific information.
I've used the following code snippet to test the changes in labkit
func main() {
errortracking.Initialize(errortracking.WithSentryDSN("https://0f1ec4d29b3e4172ae8a8554f5a2efbb@sentry.io/1467104"))
req, err := http.NewRequest("GET", "http://example.com?test=here", nil)
ctx := labkitctx.ContextWithCorrelation(req.Context(), "thisIsContextID")
req.Header.Add("test", "another")
err = errors.New("some error")
// Send the error to the error tracking system
errortracking.Capture(err,
errortracking.WithContext(ctx), // Extract details such as correlation-id from context
errortracking.WithRequest(req), // Extract additional details from request
errortracking.WithField("domain", "http://example.com"), // Add additional custom details
errortracking.WithField("steve", "test"),
)
time.Sleep(time.Minute)
}
If we look at the screenshot below the new sentry-go
library finds more information out of the box as well.
raven-go | sentry-go |
---|---|
![]() ![]() |
![]() ![]() |
We had to change the signature of CapatureOption
since we can't use the old raven structs for this.
If anyone using the default CaptureOption that we provide they will not see any changes, but if they build their own CaptureOption
this will break since the signature changed.
Closes #5 (closed)