-
Notifications
You must be signed in to change notification settings - Fork 120
/
http.go
34 lines (29 loc) · 789 Bytes
/
http.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package metrics
import (
"github.com/prometheus/client_golang/prometheus"
)
var (
HTTPRequestsTotal = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "http_requests_total",
Help: "Number of get requests.",
},
[]string{"method", "path", "code"},
)
HTTPInflightRequests = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "http_inflight_requests",
Help: "Status of HTTP response",
},
[]string{"method", "path"},
)
HTTPRequestsDuration = prometheus.NewHistogramVec(prometheus.HistogramOpts{
Name: "http_requests_duration_seconds",
Help: "Duration of HTTP requests.",
}, []string{"method", "path"})
)
func init() {
prometheus.Register(HTTPRequestsTotal)
prometheus.Register(HTTPInflightRequests)
prometheus.Register(HTTPRequestsDuration)
}