-
Notifications
You must be signed in to change notification settings - Fork 3
/
metrics.go
50 lines (45 loc) · 1.41 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
package hive2
import (
m "github.com/gauss-project/aurorafs/pkg/metrics"
"github.com/prometheus/client_golang/prometheus"
)
type metrics struct {
DoFindNode prometheus.Counter
DoFindNodePeers prometheus.Counter
OnFindNode prometheus.Counter
OnFindNodePeers prometheus.Counter
UnreachablePeers prometheus.Counter
}
func newMetrics() metrics {
subsystem := "hive2"
return metrics{
DoFindNode: prometheus.NewCounter(prometheus.CounterOpts{
Subsystem: subsystem,
Name: "do_find_node_count",
Help: "Number of peers do find node",
}),
DoFindNodePeers: prometheus.NewCounter(prometheus.CounterOpts{
Subsystem: subsystem,
Name: "do_find_node_peers_count",
Help: "Number of peers received in peer messages.",
}),
OnFindNode: prometheus.NewCounter(prometheus.CounterOpts{
Subsystem: subsystem,
Name: "on_find_node_count",
Help: "Number of peer messages received.",
}),
OnFindNodePeers: prometheus.NewCounter(prometheus.CounterOpts{
Subsystem: subsystem,
Name: "on_find_node_peers_count",
Help: "Number of peers to be sent.",
}),
UnreachablePeers: prometheus.NewCounter(prometheus.CounterOpts{
Subsystem: subsystem,
Name: "unreachable_peers_count",
Help: "Number of peers that are unreachable.",
}),
}
}
func (s *Service) Metrics() []prometheus.Collector {
return m.PrometheusCollectorsFromFields(s.metrics)
}