-
Notifications
You must be signed in to change notification settings - Fork 211
/
metrics.go
144 lines (133 loc) · 3.54 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
package vm
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/spacemeshos/go-spacemesh/metrics"
)
const namespace = "vm"
var (
transactionDuration = metrics.NewHistogramWithBuckets(
"transaction_duration",
namespace,
"Duration in ns without writing updated state on disk",
[]string{},
prometheus.ExponentialBuckets(10_000, 2, 10),
).WithLabelValues()
transactionDurationParse = metrics.NewHistogramWithBuckets(
"transaction_duration_parse",
namespace,
"Duration in ns for parsing a transaction",
[]string{},
prometheus.ExponentialBuckets(10_000, 2, 10),
).WithLabelValues()
transactionDurationVerify = metrics.NewHistogramWithBuckets(
"transaction_duration_verify",
namespace,
"Duration in ns for verifying a transaction",
[]string{},
prometheus.ExponentialBuckets(10_000, 2, 10),
).WithLabelValues()
transactionDurationExecute = metrics.NewHistogramWithBuckets(
"transaction_duration_execute",
namespace,
"Duration in ns for executing a transaction",
[]string{},
prometheus.ExponentialBuckets(10_000, 2, 10),
).WithLabelValues()
)
var (
blockDuration = metrics.NewHistogramWithBuckets(
"block_duration",
namespace,
"Duration in ns with update to disk",
[]string{},
prometheus.ExponentialBuckets(10_000_000, 2, 10),
).WithLabelValues()
blockDurationWait = metrics.NewHistogramWithBuckets(
"block_duration_wait",
namespace,
"Duration in ns for db to be ready to process transactions.",
[]string{},
prometheus.ExponentialBuckets(100_000, 2, 10),
).WithLabelValues()
blockDurationTxs = metrics.NewHistogramWithBuckets(
"block_duration_txs",
namespace,
"Duration in ns to parse and execute transactions.",
[]string{},
prometheus.ExponentialBuckets(1_000_000, 2, 10),
).WithLabelValues()
blockDurationRewards = metrics.NewHistogramWithBuckets(
"block_duration_rewards",
namespace,
"Duration in ns to compute and update rewards.",
[]string{},
prometheus.ExponentialBuckets(1_000_000, 2, 10),
).WithLabelValues()
blockDurationPersist = metrics.NewHistogramWithBuckets(
"block_duration_persist",
namespace,
"Duration in ns to write updates on disk.",
[]string{},
prometheus.ExponentialBuckets(10_000_000, 2, 10),
).WithLabelValues()
)
var writesPerBlock = metrics.NewHistogramWithBuckets(
"account_writes_per_block",
namespace,
"Number of touched (updated) accounts in the block",
[]string{},
prometheus.ExponentialBuckets(100, 10, 10),
).WithLabelValues()
var (
txCount = metrics.NewCounter(
"txs",
namespace,
"Number of transactions",
[]string{},
).WithLabelValues()
invalidTxCount = metrics.NewCounter(
"invalid_txs",
namespace,
"Number of invalid transactions.",
[]string{},
).WithLabelValues()
transactionsPerBlock = metrics.NewHistogramWithBuckets(
"transactions_per_block",
namespace,
"Number of transactions in the block",
[]string{},
prometheus.ExponentialBuckets(100, 10, 10),
).WithLabelValues()
)
var (
feesCount = metrics.NewCounter(
"fees",
namespace,
"Transaction fees",
[]string{},
).WithLabelValues()
subsidyCount = metrics.NewCounter(
"subsidy",
namespace,
"Estimated subsidy",
[]string{},
).WithLabelValues()
rewardsCount = metrics.NewCounter(
"rewards",
namespace,
"Total rewards including issuence and fees",
[]string{},
).WithLabelValues()
burntCount = metrics.NewCounter(
"rewards_burn",
namespace,
"Burnt amount of issuence and fees",
[]string{},
).WithLabelValues()
)
var appliedLayer = metrics.NewGauge(
"applied_layer",
namespace,
"Applied layer",
[]string{},
).WithLabelValues()