panics

package
v0.0.0-...-a1c22f6 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HttpHandler

func HttpHandler(name string, next http.Handler) http.Handler

HttpHandler handler wrapper to recover from panics

func HttpHandlerWithMetrics

func HttpHandlerWithMetrics(routeName string, next http.Handler, emitter httphandler.MetricEmitter) http.Handler

func Identify

func Identify() (runtime.Frame, string)

Identify returns the frame of the panic and hash of the calls stack which is useful for grouping panics it skips the stack that comes from the runtime package and recovery code run after the panic modeled after https://golang.org/pkg/runtime/#CallersFrames

func Log

func Log(ctx context.Context, name string, recovery interface{})

Log will use structured logging so we can find/group panics

func Recovery

func Recovery(ctx context.Context, name string, handlers ...func())

Recovery recovers from a panic and prints the logs as an error in the correct format. This should be deferred at the top of each go routine in order to not crash the entire process executes custom handlers so errors can be populated back to channels and other cleanup

Types

This section is empty.

Jump to

Keyboard shortcuts

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