Migrate to sentry-go
Overview
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.
Testing
I've used the following code snippet to test the changes in labkit
main.go
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 |
---|---|
![]() ![]() |
![]() ![]() |
💥
Breaking Change 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)
Merge request reports
Activity
assigned to @dcroft
mentioned in issue gitaly#2049
mentioned in merge request !37 (closed)
added devopssystems groupdistribution labels
removed devopssystems groupdistribution labels
added 29 commits
-
b2e54b57...3253d797 - 28 commits from branch
master
- 51ef0209 - Update to official sentry library
-
b2e54b57...3253d797 - 28 commits from branch
@zj-gitlab this should be ready for review, I know you were interested in this for Gitaly, maybe you can give it a first pass?
assigned to @zj-gitlab and unassigned @dcroft
@andrewn Could you review too? Wondering if the breaking change is alright?
assigned to @andrewn and unassigned @zj-gitlab
mentioned in issue gitlab-runner#4904 (closed)
mentioned in issue #5 (closed)
@andrewn is this something we should merge
🙇 ?added 8 commits
-
7c75d6b0...bd6bebe1 - 6 commits from branch
master
- 73c17c80 - Update to official sentry library
- 5978359a - Add hostname to sentry headers
-
7c75d6b0...bd6bebe1 - 6 commits from branch
I can try and take a look at it @andrewn. Do you want do to do that first before we merge?
@andrewn @steveazz do you think this will get merged soon? I'm not trying to put pressure on it, just asking to decide whether to wait for it for fixing Sentry DSN support in gitlab-runner (gitlab-runner#4904 (closed))
🏃 Sounds like a good first use-case for gitlab-runner to integrate labkit.@lraykov thanks for the ping, I've been trying to find time to rebase this on master and merge it for a long time. I'll try to find time this week
🙇
assigned to @steveazz and unassigned @andrewn
added 16 commits
-
5978359a...b34ac279 - 14 commits from branch
master
- dd5b3374 - Update to official sentry library
- 304ecf66 - Add hostname to sentry headers
-
5978359a...b34ac279 - 14 commits from branch
Setting grouprunner based on
@steveazz
's group.added grouprunner label
added 8 commits
-
304ecf66...fac94cb4 - 6 commits from branch
master
- 4a3c7eb9 - Update to official sentry library
- c7df4697 - Add hostname to sentry headers
-
304ecf66...fac94cb4 - 6 commits from branch
Ok I've rebased with master 1 more time and the pipeline is green. I've also done one more sanity check and everything seems to be working as expected. Given that there are two approvals I'm going to merge this
🙇 mentioned in commit f06e28ff
@korjavin all upstream projects should be using this version yes.