Documentation ¶
Index ¶
- func FilterHeaders(fn HeaderFilter) handlerOpt
- func HTTPMetricsHandler(registry metrics.Registry, h http.Handler) http.Handler
- func RequestBodyGzipHandler(h http.Handler) http.Handler
- func TransactionAwareRequestLoggingHandler(log *logger.UPPLogger, handler http.Handler, options ...handlerOpt) http.Handler
- type HeaderFilter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FilterHeaders ¶ added in v2.2.0
func FilterHeaders(fn HeaderFilter) handlerOpt
FilterHeaders creates a handler option that extends denied header list. When creating the log entry the handler log the request headers. For clarity and security some of the headers are filtered out by default. The default filter list could be extended by providing a callback for addition header validation. The callback will be executed after the request has been handled and before creating the new log entry
func HTTPMetricsHandler ¶
HTTPMetricsHandler records metrics for each request
func TransactionAwareRequestLoggingHandler ¶
func TransactionAwareRequestLoggingHandler(log *logger.UPPLogger, handler http.Handler, options ...handlerOpt) http.Handler
TransactionAwareRequestLoggingHandler creates new http.Handler that would add log entries to the provided logger in structured format. The handler would search for transactionID in the request headers and will generate one if it doesn't find any.
Types ¶
type HeaderFilter ¶ added in v2.3.0
HeaderFilter is a function type for additional header filtering when logging request headers The function is provided the header key as string and it's expected to return true if the header needs to be preserved.