-
Notifications
You must be signed in to change notification settings - Fork 6
/
metrics.go
69 lines (58 loc) · 1.75 KB
/
metrics.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package main
import "github.com/prometheus/client_golang/prometheus"
var (
requestSum *prometheus.CounterVec
statusCodes *prometheus.CounterVec
requestSuccess *prometheus.CounterVec
requestDuration *prometheus.SummaryVec
concurrentLimitExcess *prometheus.CounterVec
goodRequest prometheus.Counter
badRequest prometheus.Counter
)
func init() {
statusCodes = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "status_codes",
Help: "Distribution by status codes counter",
},
[]string{"user", "cluster_user", "host", "code"},
)
requestSum = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "request_sum",
Help: "Total number of sent requests",
},
[]string{"user", "cluster_user", "host"},
)
requestSuccess = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "request_success",
Help: "Total number of sent success requests",
},
[]string{"user", "cluster_user", "host"},
)
requestDuration = prometheus.NewSummaryVec(
prometheus.SummaryOpts{
Name: "request_duration",
Help: "Shows request duration",
},
[]string{"user", "cluster_user", "host"},
)
concurrentLimitExcess = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "concurrent_limit_excess",
Help: "Total number of max_concurrent_queries excess",
},
[]string{"user", "cluster_user", "host"},
)
goodRequest = prometheus.NewCounter(prometheus.CounterOpts{
Name: "good_request",
Help: "Total number of proxy requests",
})
badRequest = prometheus.NewCounter(prometheus.CounterOpts{
Name: "bad_request",
Help: "Total number of unsupported requests",
})
prometheus.MustRegister(statusCodes, requestDuration, requestSum, requestSuccess,
concurrentLimitExcess, badRequest, goodRequest)
}