sentry

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 9, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

The Sentry package contains an implementation of a bridge between the sentry-go package and glog which allows for glog errors of level ERROR to be tracked as errors in Sentry. This includes custom code that interfaces with the xerrors package (as well as the Yext fork named yerrors) in order to send stack trace data for the glog invocation, error object construction, and any masked error calls to Sentry.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AltDsn

func AltDsn(dsn string) interface{}

AltDsn can be used as a glog attribute to specify a different DSN for the issue to be sent in Sentry

func CaptureErrors

func CaptureErrors(project string, dsns []string, opts sentry.ClientOptions, comm <-chan glog.Event)

CaptureErrors is the entrypoint for tracking Sentry exceptions via glog. Given Sentry DSNs and client options (DSN should not be specified in opts), constructs individual Sentry Client's for each DSN. The glog.Event channel should be provided by running glog.RegisterBackend(). For example:

 sentry.CaptureErrors(
 	"projectName",
 	[]string{"https://primaryDsn", "https://optionalSecondaryDsn", ...},
	sentrygo.ClientOptions{
		Release: "release",
		Environment: "prod",
	},
	glog.RegisterBackend())

When an event is received via glog at the ERROR severity, the first provided DSN will be used, unless a sentry.AltDsn is tagged on the glog event, in which case the specified client for that DSN will be used:

glog.Error("error for secondary DSN", sentry.AltDsn("https://optionalSecondaryDsn"))

func Fingerprint

func Fingerprint(print ...string) interface{}

Fingerprint creates a Sentry fingerprint from a variadic set of strings. This fingerprint will be added to the outgoing event to allow for custom rollup. See: https://docs.sentry.io/learn/rollups/#customize-grouping-with-fingerprints

func FromGlogEvent

func FromGlogEvent(e glog.Event) (*sentry.Event, string)

FromGlogEvent processes a glog event and generates a corresponding Sentry event. This includes building the stacktrace, cleaning up the error title and subtitle, and identifying whether any TargetDSN or Fingerprint overrides were set.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL