Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RequestIDFromContext ¶
RequestIDFromContext returns the request id from context.
Types ¶
type MetricsMiddleware ¶
type MetricsMiddleware struct {
// contains filtered or unexported fields
}
func NewMetricsMiddleware ¶
func NewMetricsMiddleware(reg prometheus.Registerer) *MetricsMiddleware
NewMetricsMiddleware provides default MetricsMiddleware.
func (*MetricsMiddleware) NewHandler ¶
NewHandler wraps the given HTTP handler for instrumentation. It registers four metric collectors (if not already done) and reports HTTP metrics to the (newly or already) registered collectors: http_requests_total (CounterVec), http_request_duration_seconds (Histogram), http_request_size_bytes (Summary), http_response_size_bytes (Summary). Each has a constant label named "handler" with the provided handlerName as value. http_requests_total is a metric vector partitioned by HTTP method (label name "method") and HTTP status code (label name "code").