Newer
Older
Angelo Capossele
committed
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
70
71
72
73
74
package prometheus
import (
"github.com/iotaledger/goshimmer/plugins/metrics"
"github.com/prometheus/client_golang/prometheus"
)
var (
activeConflicts prometheus.Gauge
finalizedConflicts prometheus.Gauge
failedConflicts prometheus.Gauge
avgRoundToFin prometheus.Gauge
queryRx prometheus.Gauge
queryOpRx prometheus.Gauge
queryReplyNotRx prometheus.Gauge
queryOpReplyNotRx prometheus.Gauge
)
func registerFPCMetrics() {
activeConflicts = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "fpc_active_conflicts",
Help: "number of currently active conflicts",
})
finalizedConflicts = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "fpc_finalized_conflicts",
Help: "number of finalized conflicts since the start of the node",
})
failedConflicts = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "fpc_failed_conflicts",
Help: "number of failed conflicts since the start of the node",
})
avgRoundToFin = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "fpc_avg_rounds_to_finalize",
Help: "average number of rounds it takes to finalize conflicts since the start of the node",
})
queryRx = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "fpc_queries_received",
Help: "number of received voting queries",
})
queryOpRx = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "fpc_queries_opinion_received",
Help: " number of received opinion queries",
})
queryReplyNotRx = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "fpc_query_replies_not_received",
Help: "number of sent but unanswered queries for conflict opinions",
})
queryOpReplyNotRx = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "fpc_query_opinion_replies_not_received",
Help: " number of opinions that the node failed to gather from peers",
})
registry.MustRegister(activeConflicts)
registry.MustRegister(finalizedConflicts)
registry.MustRegister(failedConflicts)
registry.MustRegister(avgRoundToFin)
registry.MustRegister(queryRx)
registry.MustRegister(queryOpRx)
registry.MustRegister(queryReplyNotRx)
registry.MustRegister(queryOpReplyNotRx)
addCollect(collectFPCMetrics)
}
func collectFPCMetrics() {
activeConflicts.Set(float64(metrics.ActiveConflicts()))
finalizedConflicts.Set(float64(metrics.FinalizedConflict()))
failedConflicts.Set(float64(metrics.FailedConflicts()))
avgRoundToFin.Set(metrics.AverageRoundsToFinalize())
queryRx.Set(float64(metrics.FPCQueryReceived()))
queryOpRx.Set(float64(metrics.FPCOpinionQueryReceived()))
queryReplyNotRx.Set(float64(metrics.FPCQueryReplyErrors()))
queryOpReplyNotRx.Set(float64(metrics.FPCOpinionQueryReplyErrors()))
}