report.go 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. package bugsnag
  2. import (
  3. "github.com/bugsnag/bugsnag-go/sessions"
  4. uuid "github.com/gofrs/uuid"
  5. )
  6. type reportJSON struct {
  7. APIKey string `json:"apiKey"`
  8. Events []eventJSON `json:"events"`
  9. Notifier notifierJSON `json:"notifier"`
  10. }
  11. type notifierJSON struct {
  12. Name string `json:"name"`
  13. URL string `json:"url"`
  14. Version string `json:"version"`
  15. }
  16. type eventJSON struct {
  17. App *appJSON `json:"app"`
  18. Context string `json:"context,omitempty"`
  19. Device *deviceJSON `json:"device,omitempty"`
  20. Request *RequestJSON `json:"request,omitempty"`
  21. Exceptions []exceptionJSON `json:"exceptions"`
  22. GroupingHash string `json:"groupingHash,omitempty"`
  23. Metadata interface{} `json:"metaData"`
  24. PayloadVersion string `json:"payloadVersion"`
  25. Session *sessionJSON `json:"session,omitempty"`
  26. Severity string `json:"severity"`
  27. SeverityReason *severityReasonJSON `json:"severityReason,omitempty"`
  28. Unhandled bool `json:"unhandled"`
  29. User *User `json:"user,omitempty"`
  30. }
  31. type sessionJSON struct {
  32. StartedAt string `json:"startedAt"`
  33. ID uuid.UUID `json:"id"`
  34. Events sessions.EventCounts `json:"events"`
  35. }
  36. type appJSON struct {
  37. ReleaseStage string `json:"releaseStage"`
  38. Type string `json:"type,omitempty"`
  39. Version string `json:"version,omitempty"`
  40. }
  41. type exceptionJSON struct {
  42. ErrorClass string `json:"errorClass"`
  43. Message string `json:"message"`
  44. Stacktrace []stackFrame `json:"stacktrace"`
  45. }
  46. type severityReasonJSON struct {
  47. Type SeverityReason `json:"type,omitempty"`
  48. }
  49. type deviceJSON struct {
  50. Hostname string `json:"hostname,omitempty"`
  51. }
  52. // RequestJSON is the request information that populates the Request tab in the dashboard.
  53. type RequestJSON struct {
  54. ClientIP string `json:"clientIp,omitempty"`
  55. Headers map[string]string `json:"headers,omitempty"`
  56. HTTPMethod string `json:"httpMethod,omitempty"`
  57. URL string `json:"url,omitempty"`
  58. Referer string `json:"referer,omitempty"`
  59. }