sentryutil

package
v0.0.0-...-12d512c Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SentryLoggerHook = &sentryLoggerHook{crumbTrailLimit: sentryTrailLimit, reportLevels: logrus.AllLevels}

SentryLoggerHook forwards log entries to Sentry.

Functions

func NewSentryHubContext

func NewSentryHubContext(ctx context.Context) context.Context

NewSentryHubContext returns a copy of the parent context with an instance of its hub attached. If no hub exists, the default hub stored in the global namespace is used. This is useful for separating sentry-related data when starting new goroutines.

func NewSentryHubGinContext

func NewSentryHubGinContext(ctx context.Context) *gin.Context

NewSentryHubGinContext returns a new Gin context with a cloned hub of the original context's hub. The hub is added to the context's request so that the sentrygin middleware is able to find it.

func RecoverAndRaise

func RecoverAndRaise(ctx context.Context)

RecoverAndRaise reports the panic to Sentry then re-raises it.

func ReportError

func ReportError(ctx context.Context, err error, scopeFuncs ...func(*sentry.Scope))

ReportError reports an error with optional scope functions to add additional context.

func ReportRemappedError

func ReportRemappedError(ctx context.Context, originalErr error, remappedErr interface{})

ReportRemappedError reports an error with additional context indicating the original error and the remapped error.

func ScrubEventHeaders

func ScrubEventHeaders(event *sentry.Event, hint *sentry.EventHint) *sentry.Event

func SentryHubFromContext

func SentryHubFromContext(ctx context.Context) *sentry.Hub

SentryHubFromContext gets a Hub from the supplied context, or from an underlying gin.Context if one is available.

func SetErrorContext

func SetErrorContext(scope *sentry.Scope, mapped bool, mappedTo string)

func SpanFilterEventProcessor

func SpanFilterEventProcessor(ctx context.Context, maxSpans int, minSpanDuration time.Duration, maxFilterPasses int, alwaysFilter bool) sentry.EventProcessor

SpanFilterEventProcessor applies a progressive filter to spans, removing the shortest spans until the total span count is less than the specified maxSpans value. Initially, spans shorter than minSpanDuration will be dropped, but each filter pass (up to maxFilterPasses) will double the minSpanDuration until enough spans have been filtered out. If alwaysFilter is specified, spans shorter than minSpanDuration will be removed, even if the total span count is low enough not to require any filtering.

func TransactionNameSafe

func TransactionNameSafe(name string) sentry.SpanOption

TransactionNameSafe sets the name for the current transaction if a name is not already set.

func UpdateErrorFingerprints

func UpdateErrorFingerprints(event *sentry.Event, hint *sentry.EventHint) *sentry.Event

func UpdateLogErrorEvent

func UpdateLogErrorEvent(event *sentry.Event, hint *sentry.EventHint) *sentry.Event

UpdateLogErrorEvent updates the outgoing event with data from the logged error.

Types

This section is empty.

Jump to

Keyboard shortcuts

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