-
Notifications
You must be signed in to change notification settings - Fork 87
/
metrics.go
49 lines (44 loc) · 1.27 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
package main
import (
"github.com/prometheus/client_golang/prometheus"
)
var pushCounter = prometheus.NewCounter(
prometheus.CounterOpts{
Name: "ch_received_count",
Help: "Received requests count from launch",
})
var sentCounter = prometheus.NewCounter(
prometheus.CounterOpts{
Name: "ch_sent_count",
Help: "Sent request count from launch",
})
var dumpCounter = prometheus.NewCounter(
prometheus.CounterOpts{
Name: "ch_dump_count",
Help: "Dumps saved from launch",
})
var goodServers = prometheus.NewGauge(
prometheus.GaugeOpts{
Name: "ch_good_servers",
Help: "Actual good servers count",
})
var badServers = prometheus.NewGauge(
prometheus.GaugeOpts{
Name: "ch_bad_servers",
Help: "Actual count of bad servers",
})
var queuedDumps = prometheus.NewGauge(
prometheus.GaugeOpts{
Name: "ch_queued_dumps",
Help: "Actual dump files id directory",
})
// InitMetrics - init prometheus metrics
func InitMetrics(prefix string) {
prometheus.DefaultRegisterer = prometheus.WrapRegistererWithPrefix(prefix, prometheus.DefaultRegisterer)
prometheus.MustRegister(pushCounter)
prometheus.MustRegister(sentCounter)
prometheus.MustRegister(dumpCounter)
prometheus.MustRegister(queuedDumps)
prometheus.MustRegister(goodServers)
prometheus.MustRegister(badServers)
}