Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultResponseSizeHistogram are the default (if enabled) buckets for response size histograms. DefaultResponseSizeHistogram = []float64{32.0, 256.0, 2048.0, 16384.0, 131072.0, 1048576} // DefaultLatencyHistogram defines the default (if enabled) buckets for latency histograms. DefaultLatencyHistogram = prometheus.DefBuckets )
Functions ¶
func Middleware ¶
func Middleware(opts ...Option) httpwares.Middleware
Middleware is a server-side http ware for monitoring handlers using Prometheus counters and histograms.
Handlers are labeled by the http_ctxtags `TagForHandlerGroup` and `TagForHandlerName` applied using the http_ctxtags Middleware and HandlerName methods. These values are used as labels for all requests.
The following monitoring variables can be created if opted in using options:
http_server_requests_total http_server_response_size_bytes http_server_response_headers_duration_seconds http_server_request_duration_seconds
Please note that the instantiation of this Middleware can panic if it has been previously instantiated with other options due to clashes in Prometheus metric names.
func Tripperware ¶
func Tripperware(opts ...Option) httpwares.Tripperware
Tripperware is a client-side http ware for monitoring calls to http services.
Calls are labeled by the http_ctxtags `TagForCallService` http_ctxtags.Tripperware. By default, these are inferred from hostnames.
The following monitoring variables can be created if opted in using options:
http_client_requests_total http_client_response_headers_duration_seconds
Please note: errors in handled respo
Please note that the instantiation of this Tripperware can panic if it has been previously instantiated with other options due to clashes in Prometheus metric names.
Types ¶
type Option ¶
type Option func(*options)
func WithNamespace ¶
WithNamespace customizes the Prometheus namespace (first component before first underscore) of all the metrics.
func WithRequestCompletionLatencyHistogram ¶
WithRequestCompletionLatencyHistogram enables the middleware to record the latency to completion of request.
Optionally, you can provide your own histogram buckets for the measurements. If not provided DefaultLatencyHistogram is used.
func WithResponseHeadersLatencyHistogram ¶
WithResponseHeadersLatencyHistogram enables the middleware to record the latency to headers response in seconds.
Optionally, you can provide your own histogram buckets for the measurements. If not provided DefaultLatencyHistogram is used.
func WithResponseSizeHistogram ¶
WithResponseSizeHistogram enables the middleware to record the sizes of response messages in bytes.
Optionally, you can provide your own histogram buckets for the measurements. If not provided DefaultResponseSizeHistogram is used.