cfxcore/pos/consensus/
counters.rs1use diem_metrics::{
9 register_histogram, register_histogram_vec, register_int_counter,
10 register_int_counter_vec, register_int_gauge, DurationHistogram, Histogram,
11 HistogramVec, IntCounter, IntCounterVec, IntGauge,
12};
13use once_cell::sync::Lazy;
14
15pub static OP_COUNTERS: Lazy<diem_metrics::OpMetrics> =
21 Lazy::new(|| diem_metrics::OpMetrics::new_and_registered("consensus"));
22
23pub static ERROR_COUNT: Lazy<IntGauge> = Lazy::new(|| {
24 register_int_gauge!(
25 "diem_consensus_error_count",
26 "Total number of errors in main loop"
27 )
28 .unwrap()
29});
30
31pub static LAST_COMMITTED_ROUND: Lazy<IntGauge> = Lazy::new(|| {
33 register_int_gauge!(
34 "diem_consensus_last_committed_round",
35 "This counter is set to the round of the highest committed block."
36 )
37 .unwrap()
38});
39
40pub static LAST_COMMITTED_VERSION: Lazy<IntGauge> = Lazy::new(|| {
42 register_int_gauge!(
43 "diem_consensus_last_committed_version",
44 "The counter corresponds to the version of the last committed ledger info."
45 )
46 .unwrap()
47});
48
49pub static COMMITTED_BLOCKS_COUNT: Lazy<IntCounter> = Lazy::new(|| {
51 register_int_counter!(
52 "diem_consensus_committed_blocks_count",
53 "Count of the committed blocks since last restart."
54 )
55 .unwrap()
56});
57
58pub static COMMITTED_TXNS_COUNT: Lazy<IntCounterVec> = Lazy::new(|| {
60 register_int_counter_vec!(
61 "diem_consensus_committed_txns_count",
62 "Count of the transactions since last restart. state is success or failed",
63 &["state"]
64 )
65 .unwrap()
66});
67
68pub static PROPOSALS_COUNT: Lazy<IntCounter> = Lazy::new(|| {
75 register_int_counter!("diem_consensus_proposals_count", "Count of the block proposals sent by this validator since last restart (both primary and secondary)").unwrap()
76});
77
78pub static VOTE_NIL_COUNT: Lazy<IntCounter> = Lazy::new(|| {
81 register_int_counter!(
82 "diem_consensus_vote_nil_count",
83 "Count the number of times a validator voted for a nil block since last restart."
84 )
85 .unwrap()
86});
87
88pub static CURRENT_ROUND: Lazy<IntGauge> = Lazy::new(|| {
93 register_int_gauge!(
94 "diem_consensus_current_round",
95 "This counter is set to the last round reported by the local round_state."
96 )
97 .unwrap()
98});
99
100pub static QC_ROUNDS_COUNT: Lazy<IntCounter> = Lazy::new(|| {
102 register_int_counter!(
103 "diem_consensus_qc_rounds_count",
104 "Count of the rounds that gathered QC since last restart."
105 )
106 .unwrap()
107});
108
109pub static TIMEOUT_ROUNDS_COUNT: Lazy<IntCounter> = Lazy::new(|| {
111 register_int_counter!(
112 "diem_consensus_timeout_rounds_count",
113 "Count of the timeout rounds since last restart (close to 0 in happy path)."
114 )
115 .unwrap()
116});
117
118pub static TIMEOUT_COUNT: Lazy<IntCounter> = Lazy::new(|| {
124 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()
125});
126
127pub static ROUND_TIMEOUT_MS: Lazy<IntGauge> = Lazy::new(|| {
129 register_int_gauge!(
130 "diem_consensus_round_timeout_s",
131 "The timeout of the current round."
132 )
133 .unwrap()
134});
135
136pub static SYNC_INFO_MSGS_SENT_COUNT: Lazy<IntCounter> = Lazy::new(|| {
142 register_int_counter!(
143 "diem_consensus_sync_info_msg_sent_count",
144 "Counts the number of times the sync info message has been set since last restart."
145 )
146 .unwrap()
147});
148
149pub static EPOCH: Lazy<IntGauge> = Lazy::new(|| {
154 register_int_gauge!("diem_consensus_epoch", "Current epoch num").unwrap()
155});
156
157pub static CURRENT_EPOCH_VALIDATORS: Lazy<IntGauge> = Lazy::new(|| {
159 register_int_gauge!(
160 "diem_consensus_current_epoch_validators",
161 "The number of validators in the current epoch"
162 )
163 .unwrap()
164});
165
166pub static NUM_BLOCKS_IN_TREE: Lazy<IntGauge> = Lazy::new(|| {
173 register_int_gauge!(
174 "diem_consensus_num_blocks_in_tree",
175 "Counter for the number of blocks in the block tree (including the root)."
176 )
177 .unwrap()
178});
179
180pub static NUM_TXNS_PER_BLOCK: Lazy<Histogram> = Lazy::new(|| {
194 register_histogram!(
195 "diem_consensus_num_txns_per_block",
196 "Histogram for the number of txns per (committed) blocks."
197 )
198 .unwrap()
199});
200
201pub static BLOCK_TRACING: Lazy<HistogramVec> = Lazy::new(|| {
202 register_histogram_vec!(
203 "diem_consensus_block_tracing",
204 "Histogram for different stages of a block",
205 &["stage"]
206 )
207 .unwrap()
208});
209
210pub static WAIT_DURATION_S: Lazy<DurationHistogram> = Lazy::new(|| {
213 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())
214});
215
216#[allow(unused)]
221pub static PENDING_SELF_MESSAGES: Lazy<IntGauge> = Lazy::new(|| {
222 register_int_gauge!(
223 "diem_consensus_pending_self_messages",
224 "Count of the pending messages sent to itself in the channel"
225 )
226 .unwrap()
227});
228
229pub static PENDING_ROUND_TIMEOUTS: Lazy<IntGauge> = Lazy::new(|| {
231 register_int_gauge!(
232 "diem_consensus_pending_round_timeouts",
233 "Count of the pending outbound round timeouts"
234 )
235 .unwrap()
236});
237
238pub static PENDING_PROPOSAL_TIMEOUTS: Lazy<IntGauge> = Lazy::new(|| {
239 register_int_gauge!(
240 "diem_consensus_pending_proposal_timeouts",
241 "Count of the pending outbound proposal timeouts"
242 )
243 .unwrap()
244});
245pub static PENDING_NEW_ROUND_TIMEOUTS: Lazy<IntGauge> = Lazy::new(|| {
246 register_int_gauge!(
247 "diem_consensus_pending_new_round_timeouts",
248 "Count of the pending outbound new round timeouts"
249 )
250 .unwrap()
251});
252
253#[allow(unused)]
255pub static PENDING_CONSENSUS_NETWORK_EVENTS: Lazy<IntCounterVec> = Lazy::new(
256 || {
257 register_int_counter_vec!(
258 "diem_consensus_pending_network_events",
259 "Counters(queued,dequeued,dropped) related to pending network notifications to Consensus",
260 &["state"]
261 )
262 .unwrap()
263 },
264);
265
266pub static CONSENSUS_CHANNEL_MSGS: Lazy<IntCounterVec> = Lazy::new(|| {
268 register_int_counter_vec!(
269 "diem_consensus_channel_msgs_count",
270 "Counters(queued,dequeued,dropped) related to consensus channel",
271 &["state"]
272 )
273 .unwrap()
274});
275
276pub static BLOCK_RETRIEVAL_CHANNEL_MSGS: Lazy<IntCounterVec> =
278 Lazy::new(|| {
279 register_int_counter_vec!(
280 "diem_consensus_block_retrieval_channel_msgs_count",
281 "Counters(queued,dequeued,dropped) related to block retrieval channel",
282 &["state"]
283 )
284 .unwrap()
285 });