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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
use diem_metrics::{
register_histogram, register_histogram_vec, register_int_counter, register_int_counter_vec,
register_int_gauge, DurationHistogram, Histogram, HistogramVec, IntCounter, IntCounterVec,
IntGauge,
};
use once_cell::sync::Lazy;
pub static OP_COUNTERS: Lazy<diem_metrics::OpMetrics> =
Lazy::new(|| diem_metrics::OpMetrics::new_and_registered("consensus"));
pub static ERROR_COUNT: Lazy<IntGauge> = Lazy::new(|| {
register_int_gauge!(
"diem_consensus_error_count",
"Total number of errors in main loop"
)
.unwrap()
});
pub static LAST_COMMITTED_ROUND: Lazy<IntGauge> = Lazy::new(|| {
register_int_gauge!(
"diem_consensus_last_committed_round",
"This counter is set to the round of the highest committed block."
)
.unwrap()
});
pub static LAST_COMMITTED_VERSION: Lazy<IntGauge> = Lazy::new(|| {
register_int_gauge!(
"diem_consensus_last_committed_version",
"The counter corresponds to the version of the last committed ledger info."
)
.unwrap()
});
pub static COMMITTED_BLOCKS_COUNT: Lazy<IntCounter> = Lazy::new(|| {
register_int_counter!(
"diem_consensus_committed_blocks_count",
"Count of the committed blocks since last restart."
)
.unwrap()
});
pub static COMMITTED_TXNS_COUNT: Lazy<IntCounterVec> = Lazy::new(|| {
register_int_counter_vec!(
"diem_consensus_committed_txns_count",
"Count of the transactions since last restart. state is success or failed",
&["state"]
)
.unwrap()
});
pub static PROPOSALS_COUNT: Lazy<IntCounter> = Lazy::new(|| {
register_int_counter!("diem_consensus_proposals_count", "Count of the block proposals sent by this validator since last restart (both primary and secondary)").unwrap()
});
pub static VOTE_NIL_COUNT: Lazy<IntCounter> = Lazy::new(|| {
register_int_counter!(
"diem_consensus_vote_nil_count",
"Count the number of times a validator voted for a nil block since last restart."
)
.unwrap()
});
pub static COMMITTED_PROPOSALS_IN_WINDOW: Lazy<IntGauge> = Lazy::new(|| {
register_int_gauge!(
"diem_committed_proposals_in_window",
"Total number of this validator's committed proposals in the current reputation window"
)
.unwrap()
});
pub static COMMITTED_VOTES_IN_WINDOW: Lazy<IntGauge> = Lazy::new(|| {
register_int_gauge!(
"diem_committed_votes_in_window",
"Total number of this validator's committed votes in the current reputation window"
)
.unwrap()
});
pub static CURRENT_ROUND: Lazy<IntGauge> = Lazy::new(|| {
register_int_gauge!(
"diem_consensus_current_round",
"This counter is set to the last round reported by the local round_state."
)
.unwrap()
});
pub static QC_ROUNDS_COUNT: Lazy<IntCounter> = Lazy::new(|| {
register_int_counter!(
"diem_consensus_qc_rounds_count",
"Count of the rounds that gathered QC since last restart."
)
.unwrap()
});
pub static TIMEOUT_ROUNDS_COUNT: Lazy<IntCounter> = Lazy::new(|| {
register_int_counter!(
"diem_consensus_timeout_rounds_count",
"Count of the timeout rounds since last restart (close to 0 in happy path)."
)
.unwrap()
});
pub static TIMEOUT_COUNT: Lazy<IntCounter> = Lazy::new(|| {
register_int_counter!("diem_consensus_timeout_count", "Count the number of timeouts a node experienced since last restart (close to 0 in happy path).").unwrap()
});
pub static ROUND_TIMEOUT_MS: Lazy<IntGauge> = Lazy::new(|| {
register_int_gauge!(
"diem_consensus_round_timeout_s",
"The timeout of the current round."
)
.unwrap()
});
pub static SYNC_INFO_MSGS_SENT_COUNT: Lazy<IntCounter> = Lazy::new(|| {
register_int_counter!(
"diem_consensus_sync_info_msg_sent_count",
"Counts the number of times the sync info message has been set since last restart."
)
.unwrap()
});
pub static EPOCH: Lazy<IntGauge> =
Lazy::new(|| register_int_gauge!("diem_consensus_epoch", "Current epoch num").unwrap());
pub static CURRENT_EPOCH_VALIDATORS: Lazy<IntGauge> = Lazy::new(|| {
register_int_gauge!(
"diem_consensus_current_epoch_validators",
"The number of validators in the current epoch"
)
.unwrap()
});
pub static NUM_BLOCKS_IN_TREE: Lazy<IntGauge> = Lazy::new(|| {
register_int_gauge!(
"diem_consensus_num_blocks_in_tree",
"Counter for the number of blocks in the block tree (including the root)."
)
.unwrap()
});
pub static NUM_TXNS_PER_BLOCK: Lazy<Histogram> = Lazy::new(|| {
register_histogram!(
"diem_consensus_num_txns_per_block",
"Histogram for the number of txns per (committed) blocks."
)
.unwrap()
});
pub static BLOCK_TRACING: Lazy<HistogramVec> = Lazy::new(|| {
register_histogram_vec!(
"diem_consensus_block_tracing",
"Histogram for different stages of a block",
&["stage"]
)
.unwrap()
});
pub static WAIT_DURATION_S: Lazy<DurationHistogram> = Lazy::new(|| {
DurationHistogram::new(register_histogram!("diem_consensus_wait_duration_s", "Histogram of the time it requires to wait before inserting blocks into block store. Measured as the block's timestamp minus the local timestamp.").unwrap())
});
pub static PENDING_SELF_MESSAGES: Lazy<IntGauge> = Lazy::new(|| {
register_int_gauge!(
"diem_consensus_pending_self_messages",
"Count of the pending messages sent to itself in the channel"
)
.unwrap()
});
pub static PENDING_ROUND_TIMEOUTS: Lazy<IntGauge> = Lazy::new(|| {
register_int_gauge!(
"diem_consensus_pending_round_timeouts",
"Count of the pending outbound round timeouts"
)
.unwrap()
});
pub static PENDING_CONSENSUS_NETWORK_EVENTS: Lazy<IntCounterVec> = Lazy::new(|| {
register_int_counter_vec!(
"diem_consensus_pending_network_events",
"Counters(queued,dequeued,dropped) related to pending network notifications to Consensus",
&["state"]
)
.unwrap()
});
pub static CONSENSUS_CHANNEL_MSGS: Lazy<IntCounterVec> = Lazy::new(|| {
register_int_counter_vec!(
"diem_consensus_channel_msgs_count",
"Counters(queued,dequeued,dropped) related to consensus channel",
&["state"]
)
.unwrap()
});
pub static BLOCK_RETRIEVAL_CHANNEL_MSGS: Lazy<IntCounterVec> = Lazy::new(|| {
register_int_counter_vec!(
"diem_consensus_block_retrieval_channel_msgs_count",
"Counters(queued,dequeued,dropped) related to block retrieval channel",
&["state"]
)
.unwrap()
});
pub static DECOUPLED_EXECUTION__EXECUTION_PHASE_CHANNEL: Lazy<IntGauge> = Lazy::new(|| {
register_int_gauge!(
"decoupled_execution__execution_phase_channel",
"Number of pending ordered only blocks"
)
.unwrap()
});
pub static DECOUPLED_EXECUTION__COMMIT_PHASE_CHANNEL: Lazy<IntGauge> = Lazy::new(|| {
register_int_gauge!(
"decoupled_execution__commit_phase_channel",
"Number of pending executed blocks"
)
.unwrap()
});
pub static DECOUPLED_EXECUTION__COMMIT_MESSAGE_CHANNEL: Lazy<IntGauge> = Lazy::new(|| {
register_int_gauge!(
"decoupled_execution__commit_message_channel",
"Number of pending commit phase messages (CommitVote/CommitDecision)"
)
.unwrap()
});
pub static DECOUPLED_EXECUTION__COMMIT_MESSAGE_TIMEOUT_CHANNEL: Lazy<IntGauge> = Lazy::new(|| {
register_int_gauge!(
"decoupled_execution__commit_message_timeout_channel",
"Number of pending commit phase message timeouts (CommitVote/CommitDecision)"
)
.unwrap()
});
pub static DECOUPLED_EXECUTION__COMMIT_PHASE_RESET_CHANNEL: Lazy<IntGauge> = Lazy::new(|| {
register_int_gauge!(
"decoupled_execution__commit_phase_reset_channel",
"Number of pending commit phase reset events"
)
.unwrap()
});
pub static DECOUPLED_EXECUTION__EXECUTION_PHASE_RESET_CHANNEL: Lazy<IntGauge> = Lazy::new(|| {
register_int_gauge!(
"decoupled_execution__execution_phase_reset_channel",
"Number of pending execution phase reset events"
)
.unwrap()
});