sentry

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var OnlyServerError = func(statusCode int) bool {
	return statusCode >= 500 && statusCode < 600
}

Functions

func New

func New(opts Options) httputil.Middleware

New returns new middleware that reports problems to Sentry.

The problems must be conform to [RFC-7807](https://datatracker.ietf.org/doc/html/rfc7807).

The request's context must hold *sentry.Hub such as using sentry-go/http(https://github.com/getsentry/sentry-go/tree/master/http).

Types

type Options

type Options struct {
	// WaitForDelivery indicates whether to block the current goroutine and wait until the event has been reported to Sentry.
	WaitForDelivery bool

	// FlushTimeout for the delivery events. Defaults to 2s. Only relevant when WaitForDelivery is true.
	FlushTimeout time.Duration

	// ConsiderProblematicStatusCode tells the middleware what status code will have the problem details.
	//
	// Defaults to 500-599 considered problematic status code.
	ConsiderProblematicStatusCode func(statusCode int) bool
}

Options configure a middleware.

Jump to

Keyboard shortcuts

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