-
Notifications
You must be signed in to change notification settings - Fork 670
/
metrics.go
94 lines (87 loc) · 3.26 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// Copyright (C) 2019-2022, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package avalanche
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/ava-labs/avalanchego/utils/wrappers"
)
type metrics struct {
bootstrapFinished,
numVtxRequests, numPendingVts,
numMissingTxs, pendingTxs,
blockerVtxs, blockerTxs prometheus.Gauge
whitelistVtxIssueSuccess, whitelistVtxIssueFailure,
numUselessPutBytes, numUselessPushQueryBytes prometheus.Counter
}
func (m *metrics) Initialize(namespace string, reg prometheus.Registerer) error {
errs := wrappers.Errs{}
m.bootstrapFinished = prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: namespace,
Name: "bootstrap_finished",
Help: "Whether or not bootstrap process has completed. 1 is success, 0 is fail or ongoing.",
})
m.numVtxRequests = prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: namespace,
Name: "vtx_requests",
Help: "Number of outstanding vertex requests",
})
m.numPendingVts = prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: namespace,
Name: "pending_vts",
Help: "Number of pending vertices",
})
m.numMissingTxs = prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: namespace,
Name: "missing_txs",
Help: "Number of missing transactions",
})
m.pendingTxs = prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: namespace,
Name: "pending_txs",
Help: "Number of transactions from the VM waiting to be issued",
})
m.blockerVtxs = prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: namespace,
Name: "blocker_vtxs",
Help: "Number of vertices that are blocking other vertices from being issued because they haven't been issued",
})
m.blockerTxs = prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: namespace,
Name: "blocker_txs",
Help: "Number of transactions that are blocking other transactions from being issued because they haven't been issued",
})
m.whitelistVtxIssueSuccess = prometheus.NewCounter(prometheus.CounterOpts{
Namespace: namespace,
Name: "whitelist_vtx_issue_success",
Help: "Number of DAG linearization request issued (pending, not necessarily accepted)",
})
m.whitelistVtxIssueFailure = prometheus.NewCounter(prometheus.CounterOpts{
Namespace: namespace,
Name: "whitelist_vtx_issue_failure",
Help: "Number of DAG linearization request issue failed (verification failure)",
})
m.numUselessPutBytes = prometheus.NewCounter(prometheus.CounterOpts{
Namespace: namespace,
Name: "num_useless_put_bytes",
Help: "Amount of useless bytes received in Put messages",
})
m.numUselessPushQueryBytes = prometheus.NewCounter(prometheus.CounterOpts{
Namespace: namespace,
Name: "num_useless_push_query_bytes",
Help: "Amount of useless bytes received in PushQuery messages",
})
errs.Add(
reg.Register(m.bootstrapFinished),
reg.Register(m.numVtxRequests),
reg.Register(m.numPendingVts),
reg.Register(m.numMissingTxs),
reg.Register(m.pendingTxs),
reg.Register(m.blockerVtxs),
reg.Register(m.blockerTxs),
reg.Register(m.whitelistVtxIssueSuccess),
reg.Register(m.whitelistVtxIssueFailure),
reg.Register(m.numUselessPutBytes),
reg.Register(m.numUselessPushQueryBytes),
)
return errs.Err
}