-
Notifications
You must be signed in to change notification settings - Fork 672
/
metrics.go
68 lines (62 loc) · 2.14 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
// Copyright (C) 2019-2021, 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
}
// Initialize implements the Engine interface
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",
})
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),
)
return errs.Err
}