Skip to content

Latest commit

 

History

History
21 lines (15 loc) · 449 Bytes

README.md

File metadata and controls

21 lines (15 loc) · 449 Bytes

Keep-alive connections tracing

Writes statistic of keep-alive connections for prometheus.

vec := prometheus.NewCounterVec(
    prometheus.CounterOpts{Name: "http_keepalive"},
    []string{"service", "type"}, // type: "new", "reused"
)

client := http.Client{
    Transport: keepalivetrace.WithRoundTripper(
        http.DefaultTransport,
        keepalivetrace.NewPrometheusTracer("test.service", rate, vec),
    ),
}

client.Do(...)