forked from bugsnag/bugsnag-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
report.go
75 lines (64 loc) · 2.49 KB
/
report.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package bugsnag
import (
"github.com/bugsnag/bugsnag-go/device"
"github.com/bugsnag/bugsnag-go/sessions"
uuid "github.com/google/uuid"
)
type reportJSON struct {
APIKey string `json:"apiKey"`
Events []eventJSON `json:"events"`
Notifier notifierJSON `json:"notifier"`
}
type notifierJSON struct {
Name string `json:"name"`
URL string `json:"url"`
Version string `json:"version"`
}
type eventJSON struct {
App *appJSON `json:"app"`
Context string `json:"context,omitempty"`
Device *deviceJSON `json:"device,omitempty"`
Request *RequestJSON `json:"request,omitempty"`
Exceptions []exceptionJSON `json:"exceptions"`
GroupingHash string `json:"groupingHash,omitempty"`
Metadata interface{} `json:"metaData"`
PayloadVersion string `json:"payloadVersion"`
Session *sessionJSON `json:"session,omitempty"`
Severity string `json:"severity"`
SeverityReason *severityReasonJSON `json:"severityReason,omitempty"`
Unhandled bool `json:"unhandled"`
User *User `json:"user,omitempty"`
}
type sessionJSON struct {
StartedAt string `json:"startedAt"`
ID uuid.UUID `json:"id"`
Events sessions.EventCounts `json:"events"`
}
type appJSON struct {
ReleaseStage string `json:"releaseStage"`
Type string `json:"type,omitempty"`
Version string `json:"version,omitempty"`
}
type exceptionJSON struct {
ErrorClass string `json:"errorClass"`
Message string `json:"message"`
Stacktrace []StackFrame `json:"stacktrace"`
}
type severityReasonJSON struct {
Type SeverityReason `json:"type,omitempty"`
Attributes map[string]string `json:"attributes,omitempty"`
UnhandledOverridden bool `json:"unhandledOverridden,omitempty"`
}
type deviceJSON struct {
Hostname string `json:"hostname,omitempty"`
OsName string `json:"osName,omitempty"`
RuntimeVersions *device.RuntimeVersions `json:"runtimeVersions,omitempty"`
}
// RequestJSON is the request information that populates the Request tab in the dashboard.
type RequestJSON struct {
ClientIP string `json:"clientIp,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
HTTPMethod string `json:"httpMethod,omitempty"`
URL string `json:"url,omitempty"`
Referer string `json:"referer,omitempty"`
}