Documentation
¶
Overview ¶
Echo access logging middleware.
Echo CORS middleware configuration.
Minimal OpenTelemetry echo middleware. It starts a span from the request context, records HTTP attributes, and records errors on the span.
Echo panic recovery middleware.
Echo middleware for request identification.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AccessLog ¶
func AccessLog(logger *zerolog.Logger) echo.MiddlewareFunc
AccessLog returns echo middleware that emits one structured log line per HTTP request with method, path, status, latency, and request id.
func CORS ¶
func CORS(cfg *config.Config) echo.MiddlewareFunc
CORS returns echo's built-in CORS middleware configured from cfg.HTTP.CORS*. When no origins are configured it defaults to allowing all origins. A nil cfg yields the package CORS defaults (allow all origins, standard methods/headers, Content-Length exposed, 24h preflight cache).
func OTel ¶
func OTel() echo.MiddlewareFunc
OTel returns echo middleware that creates an OpenTelemetry span for each request using the trace.TracerProvider available via the request context. It sets standard HTTP attributes and ends the span after the handler runs, recording any returned error.
func Recover ¶
func Recover(logger *zerolog.Logger) echo.MiddlewareFunc
Recover returns echo middleware that recovers from panics, logs the failure with the request id, and returns a structured 500 response.
func RequestID ¶
func RequestID() echo.MiddlewareFunc
RequestID returns echo middleware that reads or generates an X-Request-ID header, stores it in the echo context, and echoes it back in the response.
func RequestIDFromContext ¶
RequestIDFromContext extracts the request id added by RequestID middleware.
Types ¶
This section is empty.