Documentation
¶
Overview ¶
Package instrumented_http provides a drop-in metrics-enabled replacement for any http.Client or http.RoundTripper.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // RequestDurationMicroseconds is a Prometheus summary to collect request times. RequestDurationMicroseconds = prometheus.NewSummaryVec( prometheus.SummaryOpts{ Name: "request_duration_microseconds", Help: "The HTTP request latencies in microseconds.", Subsystem: "http", ConstLabels: prometheus.Labels{"handler": handlerName}, Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}, }, []string{"scheme", "host", "path", "query", "method", "status"}, ) // EliminatingProcessor is a callback that returns a blank string on any input. EliminatingProcessor = func(_ string) string { return "" } // IdentityProcessor is callback that returns whatever is passed to it. IdentityProcessor = func(input string) string { return input } )
Functions ¶
func NewClient ¶
NewClient takes a *http.Client and returns a *http.Client that has its RoundTripper wrapped with instrumentation. Optionally, It can receive a collection of callbacks that process request path and query into a suitable label value.
func NewTransport ¶
func NewTransport(next http.RoundTripper, cbs *Callbacks) http.RoundTripper
NewTransport takes a http.RoundTripper, wraps it with instrumentation and returns it as a new http.RoundTripper. Optionally, It can receive a collection of callbacks that process request path and query into a suitable label value.
Types ¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
custom-transport
command
|
|
|
default-client
command
|
|
|
googledns
command
|
|
|
route53
command
|
Click to show internal directories.
Click to hide internal directories.