middleware

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package middleware defines common http middlewares.

Index

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

func RequestIDFromContext(ctx context.Context) string

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.

Jump to

Keyboard shortcuts

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