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.
Click to show internal directories.
Click to hide internal directories.