Documentation
¶
Overview ¶
Package recovery turns a panic in a request handler into an error for that request instead of a crashed process: gRPC and ws-proto calls get codes.Internal, HTTP requests 500. Every recovered panic is logged as an OpenTelemetry exception record (with its stack and the request's trace) and counted in backplane.panics{where}.
Index ¶
- Constants
- func Calls(log *xlog.Logger, where string) wsrpc.Middleware
- func HTTP(log *xlog.Logger, where string, next http.Handler) http.Handler
- func ServerOptions(log *xlog.Logger, where string) []grpc.ServerOption
- func Stream(log *xlog.Logger, where string) grpc.StreamServerInterceptor
- func Unary(log *xlog.Logger, where string) grpc.UnaryServerInterceptor
Constants ¶
const ( GRPCPublic = "grpc.public" GRPCInternal = "grpc.internal" WSProto = "wsproto" HTTPPublic = "http.public" HTTPPlatform = "http.platform" )
Where a panic was recovered: the value of the metric's where attribute.
Variables ¶
This section is empty.
Functions ¶
func Calls ¶ added in v0.6.46
func Calls(log *xlog.Logger, where string) wsrpc.Middleware
Calls recovers a panicking ws-proto call (its handler and the middleware after this one) into codes.Internal.
func HTTP ¶
HTTP recovers a panicking handler: the client gets 500 when nothing was written yet. http.ErrAbortHandler keeps its meaning (abort the response silently) and is re-raised for net/http.
func ServerOptions ¶
func ServerOptions(log *xlog.Logger, where string) []grpc.ServerOption
ServerOptions installs Unary and Stream first in the server's chain, so they also cover the interceptors that follow.
Types ¶
This section is empty.