Documentation ¶
Overview ¶
Package middleware defines common http middlewares.
Index ¶
- func PopulateLogger(originalLogger *zap.SugaredLogger) mux.MiddlewareFunc
- func PopulateObservability() mux.MiddlewareFunc
- func PopulateRequestID() mux.MiddlewareFunc
- func ProcessChaff(t *chaff.Tracker) mux.MiddlewareFunc
- func ProcessMaintenance(cfg Maintainable) mux.MiddlewareFunc
- func Recovery() mux.MiddlewareFunc
- func RequestIDFromContext(ctx context.Context) string
- type Maintainable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PopulateLogger ¶
func PopulateLogger(originalLogger *zap.SugaredLogger) mux.MiddlewareFunc
PopulateLogger populates the logger onto the context.
func PopulateObservability ¶
func PopulateObservability() mux.MiddlewareFunc
PopulateObservability sets common observability context fields.
func PopulateRequestID ¶
func PopulateRequestID() mux.MiddlewareFunc
PopulateRequestID populates the request context with a random UUID if one does not already exist.
func ProcessChaff ¶
func ProcessChaff(t *chaff.Tracker) mux.MiddlewareFunc
ProcessChaff injects the chaff processing middleware.
func ProcessMaintenance ¶
func ProcessMaintenance(cfg Maintainable) mux.MiddlewareFunc
func Recovery ¶ added in v0.25.0
func Recovery() mux.MiddlewareFunc
Recovery recovers from panics and other fatal errors. It keeps the server and service running, returning 500 to the caller while also logging the error in a structured format.
func RequestIDFromContext ¶
RequestIDFromContext pulls the request ID from the context, if one was set. If one was not set, it returns the empty string.
Types ¶
type Maintainable ¶
type Maintainable interface {
MaintenanceMode() bool
}
Maintainable is an interface that determines if the implementer can supply maintenance mode settings.