Documentation ¶
Overview ¶
Package chi provides Sentry integration for servers based on the chi router.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
A Handler is an HTTP middleware factory that provides integration with Sentry.
func New ¶
New returns a new Handler. Use the Handle and HandleFunc methods to wrap existing HTTP handlers.
func (*Handler) Handle ¶
Handle works as a middleware that wraps an existing http.Handler. A wrapped handler will recover from and report panics to Sentry, and provide access to a request-specific hub to report messages and errors.
func (*Handler) HandleFunc ¶
func (h *Handler) HandleFunc(handler http.HandlerFunc) http.HandlerFunc
HandleFunc is like Handle, but with a handler function parameter for cases where that is convenient. In particular, use it to wrap a handler function literal.
http.Handle(pattern, h.HandleFunc(func (w http.ResponseWriter, r *http.Request) { // handler code here }))
type Options ¶
type Options struct { // Repanic configures whether to panic again after recovering from a panic. // Use this option if you have other panic handlers or want the default // behavior from Go's http package, as documented in // https://golang.org/pkg/net/http/#Handler. Repanic bool // WaitForDelivery indicates, in case of a panic, whether to block the // current goroutine and wait until the panic event has been reported to // Sentry before repanicking or resuming normal execution. // // This option is normally not needed. Unless you need different behaviors // for different HTTP handlers, configure the SDK to use the // HTTPSyncTransport instead. // // Waiting (or using HTTPSyncTransport) is useful when the web server runs // in an environment that interrupts execution at the end of a request flow, // like modern serverless platforms. WaitForDelivery bool // Timeout for the delivery of panic events. Defaults to 2s. Only relevant // when WaitForDelivery is true. // // If the timeout is reached, the current goroutine is no longer blocked // waiting, but the delivery is not canceled. Timeout time.Duration }
Options configure a Handler.