MCPcopy Index your code
hub / github.com/cockroachdb/errors / ReportError

Function ReportError

report/report.go:365–392  ·  view source on GitHub ↗

ReportError reports the given error to Sentry. The caller is responsible for checking whether telemetry is enabled, and calling the sentry.Flush() function to wait for the report to be uploaded. (By default, Sentry submits reports asynchronously.) Note: an empty 'eventID' can be returned which sign

(err error)

Source from the content-addressed store, hash-verified

363// configured or Sentry client decided to not report the error (due to
364// configured sampling rate, callbacks, Sentry's event processors, etc).
365func ReportError(err error) (eventID string) {
366 event, extraDetails := BuildSentryReport(err)
367
368 if event.Contexts == nil {
369 event.Contexts = make(map[string]sentry.Context)
370 }
371 for extraKey, extraValue := range extraDetails {
372 event.Contexts[extraKey] = sentry.Context{"value": extraValue}
373 }
374
375 // Avoid leaking the machine's hostname by injecting the literal "<redacted>".
376 // Otherwise, sentry.Client.Capture will see an empty ServerName field and
377 // automatically fill in the machine's hostname.
378 event.ServerName = "<redacted>"
379
380 tags := map[string]string{
381 "report_type": "error",
382 }
383 for key, value := range tags {
384 event.Tags[key] = value
385 }
386
387 res := sentry.CaptureEvent(event)
388 if res != nil {
389 eventID = string(*res)
390 }
391 return
392}
393
394func lastPathComponent(tn string) string {
395 // Strip the path prefix.

Callers 3

ReportErrorFunction · 0.92
TestReportFunction · 0.92
TestDatadrivenFunction · 0.92

Calls 1

BuildSentryReportFunction · 0.70

Tested by 2

TestReportFunction · 0.74
TestDatadrivenFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…