A Go http.RoundTripper
that exports request statistics via Prometheus.
Transparently inject instrumented_http
into any http.Client
or http.RoundTripper
and get metrics about all requests made.
$ curl -Ss 127.0.0.1:9099/metrics | grep http
http_request_duration_seconds{handler="instrumented_http",host="my-cluster.example.org",method="GET",path="pods",query="",scheme="https",status="200",quantile="0.5"} 0.83626
http_request_duration_seconds{handler="instrumented_http",host="my-cluster.example.org",method="GET",path="pods",query="",scheme="https",status="200",quantile="0.9"} 0.736648
http_request_duration_seconds{handler="instrumented_http",host="my-cluster.example.org",method="GET",path="pods",query="",scheme="https",status="200",quantile="0.99"} 0.736648
http_request_duration_seconds_sum{handler="instrumented_http",host="my-cluster.example.org",method="GET",path="pods",query="",scheme="https",status="200"} 0.820274243
http_request_duration_seconds_count{handler="instrumented_http",host="my-cluster.example.org",method="GET",path="pods",query="",scheme="https",status="200"} 2
Browse the examples directory to see how instrumented_http
works with:
- http.DefaultClient: examples/default-client
- a custom http.Transport: examples/custom-transport
- the Google CloudDNS client: examples/googledns
- the AWS Route53 client: examples/route53
- the AWS Route53 (v2) client: examples/route53v2
- the Kubernetes client: examples/kubernetes
- Resty: examples/resty
- Sling: examples/sling
- Gentleman: examples/gentleman