yklyahin / keepalive-trace

Monitoring of keep-alive connections

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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(...)

About

Monitoring of keep-alive connections


Languages

Language:Go 100.0%