-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathintegration.go
49 lines (37 loc) · 1.07 KB
/
integration.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package sentrus
import (
"strings"
"github.com/getsentry/sentry-go"
)
type IsNotInAppFrameIntegration struct{}
func (sentrusIntegration *IsNotInAppFrameIntegration) Name() string {
return "SentrusIsNotInAppFrame"
}
func (sentrusIntegration *IsNotInAppFrameIntegration) SetupOnce(client *sentry.Client) {
client.AddEventProcessor(sentrusIntegration.processor)
}
func (sentrusIntegration *IsNotInAppFrameIntegration) processor(event *sentry.Event, _ *sentry.EventHint) *sentry.Event {
for i := range event.Threads {
exception := &event.Threads[i]
stacktrace := exception.Stacktrace
if stacktrace != nil {
filterFrame(stacktrace.Frames)
}
}
for i := range event.Exception {
exception := &event.Exception[i]
stacktrace := exception.Stacktrace
if stacktrace != nil {
filterFrame(stacktrace.Frames)
}
}
return event
}
func filterFrame(frames []sentry.Frame) {
for j := range frames {
frame := &frames[j]
if frame.Module == "github.com/sirupsen/logrus" || strings.HasPrefix(frame.Module, "github.com/orandin/sentrus") {
frame.InApp = false
}
}
}