middleware

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCORSMiddleware

func NewCORSMiddleware(allowedOrigins string) mux.MiddlewareFunc

func NewLogRequestMiddleware

func NewLogRequestMiddleware(logger *zap.Logger) mux.MiddlewareFunc

NewLogRequestMiddleware logs important debugging information about the incoming request like its `method`, the `host`, the `url` and the `headers`.

func NewTracingLoggingMiddleware

func NewTracingLoggingMiddleware(logger *zap.Logger) mux.MiddlewareFunc

NewTracingLoggingMiddleware adds a request specific logger containing the `trace_id` of the request extracted from the request propagation mechanism HTTP handlers can then easily extract a request specific logger using:

`logging.Logger(request.Context(), zlog)`

Types

type RandomTraceGetter

type RandomTraceGetter struct{}

RandomTrace is a fallback to insert a random trace ID if none was acquired from previous header lookups

func (RandomTraceGetter) Extract

Extract gives you a context with random TraceID and SpanID inserted if it didn't exist yet

func (RandomTraceGetter) Fields

func (p RandomTraceGetter) Fields() []string

Fields returns an empty list in RandomTraceGetter

func (RandomTraceGetter) Inject

Inject does not inject anything in RandomTraceGetter

Jump to

Keyboard shortcuts

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