Documentation ¶
Index ¶
- Constants
- Variables
- func RequestIdMiddleware() echo.MiddlewareFunc
- func RequestIdMiddlewareWithConfig(config RequestIdMiddlewareConfig) echo.MiddlewareFunc
- func RequestLoggerMiddleware() echo.MiddlewareFunc
- func RequestLoggerMiddlewareWithConfig(config RequestLoggerMiddlewareConfig) echo.MiddlewareFunc
- func RequestMetricsMiddleware() echo.MiddlewareFunc
- func RequestMetricsMiddlewareWithConfig(config RequestMetricsMiddlewareConfig) echo.MiddlewareFunc
- func RequestTracerMiddleware(serviceName string) echo.MiddlewareFunc
- func RequestTracerMiddlewareWithConfig(serviceName string, config RequestTracerMiddlewareConfig) echo.MiddlewareFunc
- type RequestIdMiddlewareConfig
- type RequestLoggerMiddlewareConfig
- type RequestMetricsMiddlewareConfig
- type RequestTracerMiddlewareConfig
Constants ¶
const ( HeaderXRequestId = "x-request-id" HeaderTraceParent = "traceparent" LogFieldRequestId = "requestID" )
const ( HttpServerMetricsRequestsCount = "http_server_requests_total" HttpServerMetricsRequestsDuration = "http_server_requests_duration_seconds" HttpServerMetricsNotFoundPath = "/not-found" )
Variables ¶
var DefaultRequestIdMiddlewareConfig = RequestIdMiddlewareConfig{ Skipper: middleware.DefaultSkipper, Generator: uuid.NewDefaultUuidGenerator(), RequestIdHeader: echo.HeaderXRequestID, }
DefaultRequestIdMiddlewareConfig is the default configuration for the RequestIdMiddleware.
var DefaultRequestLoggerMiddlewareConfig = RequestLoggerMiddlewareConfig{ Skipper: middleware.DefaultSkipper, LogLevelFromResponseOrErrorCode: false, RequestHeadersToLog: map[string]string{HeaderXRequestId: LogFieldRequestId}, RequestUriPrefixesToExclude: []string{}, }
DefaultRequestLoggerMiddlewareConfig is the default configuration for the RequestLoggerMiddleware.
var DefaultRequestMetricsMiddlewareConfig = RequestMetricsMiddlewareConfig{ Skipper: middleware.DefaultSkipper, Registry: prometheus.DefaultRegisterer, Namespace: "", Subsystem: "", Buckets: prometheus.DefBuckets, NormalizeRequestPath: true, NormalizeResponseStatus: true, }
DefaultRequestMetricsMiddlewareConfig is the default configuration for the RequestMetricsMiddleware.
var DefaultRequestTracerMiddlewareConfig = RequestTracerMiddlewareConfig{ Skipper: middleware.DefaultSkipper, TracerProvider: otel.GetTracerProvider(), TextMapPropagator: propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{}), RequestUriPrefixesToExclude: []string{}, }
DefaultRequestTracerMiddlewareConfig is the default configuration for the RequestTracerMiddleware.
Functions ¶
func RequestIdMiddleware ¶
func RequestIdMiddleware() echo.MiddlewareFunc
RequestIdMiddleware returns a RequestIdMiddleware with the DefaultRequestIdMiddlewareConfig.
func RequestIdMiddlewareWithConfig ¶
func RequestIdMiddlewareWithConfig(config RequestIdMiddlewareConfig) echo.MiddlewareFunc
RequestIdMiddlewareWithConfig returns a RequestIdMiddleware for a provided RequestIdMiddlewareConfig.
func RequestLoggerMiddleware ¶
func RequestLoggerMiddleware() echo.MiddlewareFunc
RequestLoggerMiddleware returns a RequestLoggerMiddleware with the DefaultRequestLoggerMiddlewareConfig.
func RequestLoggerMiddlewareWithConfig ¶
func RequestLoggerMiddlewareWithConfig(config RequestLoggerMiddlewareConfig) echo.MiddlewareFunc
RequestLoggerMiddlewareWithConfig returns a RequestLoggerMiddleware for a provided RequestLoggerMiddlewareConfig.
func RequestMetricsMiddleware ¶
func RequestMetricsMiddleware() echo.MiddlewareFunc
RequestMetricsMiddleware returns a RequestMetricsMiddleware with the DefaultRequestMetricsMiddlewareConfig.
func RequestMetricsMiddlewareWithConfig ¶
func RequestMetricsMiddlewareWithConfig(config RequestMetricsMiddlewareConfig) echo.MiddlewareFunc
RequestMetricsMiddlewareWithConfig returns a RequestMetricsMiddleware for a provided RequestMetricsMiddlewareConfig.
func RequestTracerMiddleware ¶
func RequestTracerMiddleware(serviceName string) echo.MiddlewareFunc
RequestTracerMiddleware returns a RequestTracerMiddleware with the DefaultRequestTracerMiddlewareConfig.
func RequestTracerMiddlewareWithConfig ¶
func RequestTracerMiddlewareWithConfig(serviceName string, config RequestTracerMiddlewareConfig) echo.MiddlewareFunc
RequestTracerMiddlewareWithConfig returns a RequestTracerMiddleware for a provided RequestTracerMiddlewareConfig.
Types ¶
type RequestIdMiddlewareConfig ¶
type RequestIdMiddlewareConfig struct { Skipper middleware.Skipper Generator uuid.UuidGenerator RequestIdHeader string }
RequestIdMiddlewareConfig is the configuration for the RequestIdMiddleware.
type RequestLoggerMiddlewareConfig ¶
type RequestLoggerMiddlewareConfig struct { Skipper middleware.Skipper LogLevelFromResponseOrErrorCode bool RequestHeadersToLog map[string]string RequestUriPrefixesToExclude []string }
RequestLoggerMiddlewareConfig is the configuration for the RequestLoggerMiddleware.
type RequestMetricsMiddlewareConfig ¶
type RequestMetricsMiddlewareConfig struct { Skipper middleware.Skipper Registry prometheus.Registerer Namespace string Buckets []float64 Subsystem string NormalizeRequestPath bool NormalizeResponseStatus bool }
RequestMetricsMiddlewareConfig is the configuration for the RequestMetricsMiddleware.
type RequestTracerMiddlewareConfig ¶
type RequestTracerMiddlewareConfig struct { Skipper middleware.Skipper TracerProvider oteltrace.TracerProvider TextMapPropagator propagation.TextMapPropagator RequestUriPrefixesToExclude []string }
RequestTracerMiddlewareConfig is the configuration for the RequestTracerMiddleware.