Skip to content

Commit 960c5a7

Browse files
committed
TUN-7551: Complete removal of raven-go to sentry-go
Removes the final usage of raven-go and removes the dependency.
1 parent aca3575 commit 960c5a7

File tree

21 files changed

+7
-5319
lines changed

21 files changed

+7
-5319
lines changed

go.mod

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ require (
1010
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf
1111
github.com/facebookgo/grace v0.0.0-20180706040059-75cf19382434
1212
github.com/fsnotify/fsnotify v1.4.9
13-
github.com/getsentry/raven-go v0.2.0
1413
github.com/getsentry/sentry-go v0.16.0
1514
github.com/go-chi/chi/v5 v5.0.8
15+
github.com/go-chi/cors v1.2.1
1616
github.com/go-jose/go-jose/v3 v3.0.0
1717
github.com/gobwas/ws v1.0.4
1818
github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3
@@ -55,7 +55,6 @@ require (
5555
github.com/BurntSushi/toml v1.2.0 // indirect
5656
github.com/apparentlymart/go-cidr v1.1.0 // indirect
5757
github.com/beorn7/perks v1.0.1 // indirect
58-
github.com/certifi/gocertifi v0.0.0-20210507211836-431795d63e8d // indirect
5958
github.com/cespare/xxhash/v2 v2.1.2 // indirect
6059
github.com/cloudflare/circl v1.2.1-0.20220809205628-0a9554f37a47 // indirect
6160
github.com/coredns/caddy v1.1.1 // indirect
@@ -66,7 +65,6 @@ require (
6665
github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 // indirect
6766
github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 // indirect
6867
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 // indirect
69-
github.com/go-chi/cors v1.2.1 // indirect
7068
github.com/go-logr/logr v1.2.3 // indirect
7169
github.com/go-logr/stdr v1.2.2 // indirect
7270
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect

go.sum

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,6 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r
7474
github.com/bwesterb/go-ristretto v1.2.2/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0=
7575
github.com/cenkalti/backoff/v4 v4.1.2/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw=
7676
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
77-
github.com/certifi/gocertifi v0.0.0-20210507211836-431795d63e8d h1:S2NE3iHSwP0XV47EEXL8mWmRdEfGscSJ+7EgePNgt0s=
78-
github.com/certifi/gocertifi v0.0.0-20210507211836-431795d63e8d/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA=
7977
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
8078
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
8179
github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE=
@@ -145,8 +143,6 @@ github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjr
145143
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
146144
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
147145
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
148-
github.com/getsentry/raven-go v0.2.0 h1:no+xWJRb5ZI7eE8TWgIq1jLulQiIoLG0IfYxv5JYMGs=
149-
github.com/getsentry/raven-go v0.2.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ=
150146
github.com/getsentry/sentry-go v0.16.0 h1:owk+S+5XcgJLlGR/3+3s6N4d+uKwqYvh/eS0AIMjPWo=
151147
github.com/getsentry/sentry-go v0.16.0/go.mod h1:ZXCloQLj0pG7mja5NK6NPf2V4A88YJ4pNlc2mOHwh6Y=
152148
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=

stream/stream.go

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"sync/atomic"
99
"time"
1010

11-
"github.com/getsentry/raven-go"
11+
"github.com/getsentry/sentry-go"
1212
"github.com/pkg/errors"
1313
"github.com/rs/zerolog"
1414

@@ -58,24 +58,15 @@ func unidirectionalStream(dst io.Writer, src io.Reader, dir string, status *bidi
5858
// server/origin listens forever until closure), it may read/write from the underlying ReadWriter (backed by
5959
// the Edge<->cloudflared transport) in an unexpected state.
6060
// Because of this, we set this recover() logic.
61-
if r := recover(); r != nil {
61+
if err := recover(); err != nil {
6262
if status.isAnyDone() {
6363
// We handle such unexpected errors only when we detect that one side of the streaming is done.
64-
log.Debug().Msgf("Gracefully handled error %v in Streaming for %s, error %s", r, dir, debug.Stack())
64+
log.Debug().Msgf("recovered from panic in stream.Pipe for %s, error %s, %s", dir, err, debug.Stack())
6565
} else {
6666
// Otherwise, this is unexpected, but we prevent the program from crashing anyway.
67-
log.Warn().Msgf("Gracefully handled unexpected error %v in Streaming for %s, error %s", r, dir, debug.Stack())
68-
69-
tags := make(map[string]string)
70-
tags["root"] = "websocket.stream"
71-
tags["dir"] = dir
72-
switch rval := r.(type) {
73-
case error:
74-
raven.CaptureError(rval, tags)
75-
default:
76-
rvalStr := fmt.Sprint(rval)
77-
raven.CaptureMessage(rvalStr, tags)
78-
}
67+
log.Warn().Msgf("recovered from panic in stream.Pipe for %s, error %s, %s", dir, err, debug.Stack())
68+
sentry.CurrentHub().Recover(err)
69+
sentry.Flush(time.Second * 5)
7970
}
8071
}
8172
}()

0 commit comments

Comments
 (0)