Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/linki/instrumented_http
A Go http.RoundTripper that exports request statistics via Prometheus.
https://github.com/linki/instrumented_http
Last synced: 2 months ago
JSON representation
A Go http.RoundTripper that exports request statistics via Prometheus.
- Host: GitHub
- URL: https://github.com/linki/instrumented_http
- Owner: linki
- License: mit
- Created: 2017-05-04T16:05:28.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-04-14T14:20:57.000Z (over 3 years ago)
- Last Synced: 2024-10-12T18:53:45.457Z (3 months ago)
- Language: Go
- Size: 37.1 KB
- Stars: 21
- Watchers: 4
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# instrumented_http
A Go `http.RoundTripper` that exports request statistics via [Prometheus](https://prometheus.io/).
# Example
Transparently inject `instrumented_http` into any `http.Client` or `http.RoundTripper` and get metrics about all requests made.
```console
$ 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
```# Usage
Browse the [examples](examples) directory to see how `instrumented_http` works with:
* [http.DefaultClient](https://golang.org/pkg/net/http/#Client): [examples/default-client](examples/default-client)
* a custom [http.Transport](https://golang.org/pkg/net/http/#Transport): [examples/custom-transport](examples/custom-transport)
* the [Google CloudDNS](https://godoc.org/google.golang.org/api/dns/v1) client: [examples/googledns](examples/googledns)
* the [AWS Route53](https://godoc.org/github.com/aws/aws-sdk-go/service/route53) client: [examples/route53](examples/route53)
* the [AWS Route53 (v2)](https://godoc.org/github.com/aws/aws-sdk-go-v2/service/route53) client: [examples/route53v2](examples/route53v2)
* the [Kubernetes](https://godoc.org/k8s.io/client-go) client: [examples/kubernetes](examples/kubernetes)
* [Resty](https://github.com/go-resty/resty): [examples/resty](examples/resty)
* [Sling](https://github.com/dghubble/sling): [examples/sling](examples/sling)
* [Gentleman](https://github.com/h2non/gentleman): [examples/gentleman](examples/gentleman)