File tree Expand file tree Collapse file tree 1 file changed +30
-1
lines changed Expand file tree Collapse file tree 1 file changed +30
-1
lines changed Original file line number Diff line number Diff line change 11package telemetry
22
33import (
4+ "context"
5+ "errors"
6+ "strings"
7+
48 "github.com/getsentry/sentry-go"
59 "go.opentelemetry.io/otel"
610 "go.uber.org/zap"
@@ -16,5 +20,30 @@ func (eh ErrorHandler) Handle(err error) {
1620 // +1 for this wrapper, +3 for opentelemetry-go's internal error handling code
1721 log := logger .WithOptions (zap .AddCallerSkip (4 ))
1822 log .Warn ("opentelemetry error" , zap .Error (err ))
19- sentry .CaptureException (err )
23+ switch {
24+ case logOnlyError (err ):
25+ // do not capture these errors in sentry
26+ default :
27+ sentry .CaptureException (err )
28+ }
29+ }
30+
31+ func logOnlyError (err error ) bool {
32+ switch {
33+ case errors .Is (err , context .DeadlineExceeded ):
34+ return true
35+ // Server said go away
36+ case strings .Contains (err .Error (), "GO AWAY" ):
37+ return true
38+ // Connection reset by peer, this isn't something we can do much about
39+ case strings .Contains (err .Error (), "connection reset by peer" ):
40+ return true
41+ // processor export timeout, this is not actionable by us, happens in `POST`
42+ case strings .Contains (err .Error (), "processor export timeout" ):
43+ return true
44+ // cannot rewind body, happens when retrying a request with a non-rewindable body
45+ case strings .Contains (err .Error (), "cannot rewind body" ):
46+ return true
47+ }
48+ return false
2049}
You can’t perform that action at this time.
0 commit comments