cat_gateway/metrics/chain_follower/
reporter.rs1#![allow(clippy::unwrap_used)]
5
6use std::sync::LazyLock;
7
8use prometheus::{register_int_gauge_vec, IntGaugeVec};
9
10const FOLLOWER_METRIC_LABELS: [&str; 3] = ["api_host_names", "service_id", "network"];
12
13pub(super) static MITHRIL_UPDATES: LazyLock<IntGaugeVec> = LazyLock::new(|| {
17 register_int_gauge_vec!(
18 format!("follower_mithril_updates"),
19 "Number of Mithril Snapshots that have downloaded successfully",
20 &FOLLOWER_METRIC_LABELS
21 )
22 .unwrap()
23});
24
25pub(super) static MITHRIL_TIP: LazyLock<IntGaugeVec> = LazyLock::new(|| {
27 register_int_gauge_vec!(
28 format!("follower_mithril_tip"),
29 "Immutable TIP Slot#",
30 &FOLLOWER_METRIC_LABELS
31 )
32 .unwrap()
33});
34
35pub(super) static MITHRIL_DL_START: LazyLock<IntGaugeVec> = LazyLock::new(|| {
37 register_int_gauge_vec!(
38 format!("follower_mithril_dl_start"),
39 "Time we started downloading the current snapshot (UNIX timestamp)",
40 &FOLLOWER_METRIC_LABELS
41 )
42 .unwrap()
43});
44
45pub(super) static MITHRIL_DL_END: LazyLock<IntGaugeVec> = LazyLock::new(|| {
47 register_int_gauge_vec!(
48 format!("follower_mithril_dl_end"),
49 "Time we finished downloading the current snapshot (UNIX timestamp)",
50 &FOLLOWER_METRIC_LABELS
51 )
52 .unwrap()
53});
54
55pub(super) static MITHRIL_DL_FAILURES: LazyLock<IntGaugeVec> = LazyLock::new(|| {
57 register_int_gauge_vec!(
58 format!("follower_mithril_dl_failures"),
59 "Number of times download failed",
60 &FOLLOWER_METRIC_LABELS
61 )
62 .unwrap()
63});
64
65pub(super) static MITHRIL_LAST_DL_DURATION: LazyLock<IntGaugeVec> = LazyLock::new(|| {
67 register_int_gauge_vec!(
68 format!("follower_mithril_last_dl_duration"),
69 "Time the last download took (seconds)",
70 &FOLLOWER_METRIC_LABELS
71 )
72 .unwrap()
73});
74
75pub(super) static MITHRIL_DL_SIZE: LazyLock<IntGaugeVec> = LazyLock::new(|| {
77 register_int_gauge_vec!(
78 format!("follower_mithril_dl_size"),
79 "Size of the download archive (bytes)",
80 &FOLLOWER_METRIC_LABELS
81 )
82 .unwrap()
83});
84
85pub(super) static MITHRIL_EXTRACT_FAILURES: LazyLock<IntGaugeVec> = LazyLock::new(|| {
87 register_int_gauge_vec!(
88 format!("follower_mithril_extract_failures"),
89 "Number of times extraction failed",
90 &FOLLOWER_METRIC_LABELS
91 )
92 .unwrap()
93});
94
95pub(super) static MITHRIL_EXTRACT_START: LazyLock<IntGaugeVec> = LazyLock::new(|| {
97 register_int_gauge_vec!(
98 format!("follower_mithril_extract_start"),
99 "Extraction start time (UNIX timestamp)",
100 &FOLLOWER_METRIC_LABELS
101 )
102 .unwrap()
103});
104
105pub(super) static MITHRIL_EXTRACT_END: LazyLock<IntGaugeVec> = LazyLock::new(|| {
107 register_int_gauge_vec!(
108 format!("follower_mithril_extract_end"),
109 "Extraction end time (UNIX timestamp)",
110 &FOLLOWER_METRIC_LABELS
111 )
112 .unwrap()
113});
114
115pub(super) static MITHRIL_EXTRACT_SIZE: LazyLock<IntGaugeVec> = LazyLock::new(|| {
117 register_int_gauge_vec!(
118 format!("follower_mithril_extract_size"),
119 "Size of last extracted snapshot (bytes)",
120 &FOLLOWER_METRIC_LABELS
121 )
122 .unwrap()
123});
124
125pub(super) static MITHRIL_DEDUPLICATED_SIZE: LazyLock<IntGaugeVec> = LazyLock::new(|| {
127 register_int_gauge_vec!(
128 format!("follower_mithril_deduplicated_size"),
129 "Deduplicated Size vs previous snapshot",
130 &FOLLOWER_METRIC_LABELS
131 )
132 .unwrap()
133});
134
135pub(super) static MITHRIL_DEDUPLICATED: LazyLock<IntGaugeVec> = LazyLock::new(|| {
137 register_int_gauge_vec!(
138 format!("follower_mithril_deduplicated"),
139 "Number of identical files deduplicated from previous snapshot",
140 &FOLLOWER_METRIC_LABELS
141 )
142 .unwrap()
143});
144
145pub(super) static MITHRIL_CHANGED: LazyLock<IntGaugeVec> = LazyLock::new(|| {
147 register_int_gauge_vec!(
148 format!("follower_mithril_changed"),
149 "Number of changed files from previous snapshot",
150 &FOLLOWER_METRIC_LABELS
151 )
152 .unwrap()
153});
154
155pub(super) static MITHRIL_NEW: LazyLock<IntGaugeVec> = LazyLock::new(|| {
157 register_int_gauge_vec!(
158 format!("follower_mithril_new"),
159 "Number of new files from previous snapshot",
160 &FOLLOWER_METRIC_LABELS
161 )
162 .unwrap()
163});
164
165pub(super) static MITHRIL_VALIDATE_START: LazyLock<IntGaugeVec> = LazyLock::new(|| {
167 register_int_gauge_vec!(
168 format!("follower_mithril_validate_start"),
169 "Mithril Certificate Validation Start Time (UNIX timestamp)",
170 &FOLLOWER_METRIC_LABELS
171 )
172 .unwrap()
173});
174
175pub(super) static MITHRIL_VALIDATE_END: LazyLock<IntGaugeVec> = LazyLock::new(|| {
177 register_int_gauge_vec!(
178 format!("follower_mithril_validate_end"),
179 "Mithril Certificate Validation End Time (UNIX timestamp)",
180 &FOLLOWER_METRIC_LABELS
181 )
182 .unwrap()
183});
184
185pub(super) static MITHRIL_VALIDATE_FAILURES: LazyLock<IntGaugeVec> = LazyLock::new(|| {
187 register_int_gauge_vec!(
188 format!("follower_mithril_validate_failures"),
189 "Number of times validation failed (bad snapshot)",
190 &FOLLOWER_METRIC_LABELS
191 )
192 .unwrap()
193});
194
195pub(super) static MITHRIL_INVALID_BLOCKS: LazyLock<IntGaugeVec> = LazyLock::new(|| {
197 register_int_gauge_vec!(
198 format!("follower_mithril_invalid_blocks"),
199 "Blocks that failed to deserialize from the Mithril immutable chain",
200 &FOLLOWER_METRIC_LABELS
201 )
202 .unwrap()
203});
204
205pub(super) static MITHRIL_DOWNLOAD_OR_VALIDATION_FAILED: LazyLock<IntGaugeVec> =
207 LazyLock::new(|| {
208 register_int_gauge_vec!(
209 format!("follower_mithril_download_or_validation_failed"),
210 "Download or Validation Failed",
211 &FOLLOWER_METRIC_LABELS
212 )
213 .unwrap()
214 });
215
216pub(super) static MITHRIL_FAILED_TO_GET_TIP: LazyLock<IntGaugeVec> = LazyLock::new(|| {
218 register_int_gauge_vec!(
219 format!("follower_mithril_failed_to_get_tip"),
220 "Failed to get tip from Mithril snapshot",
221 &FOLLOWER_METRIC_LABELS
222 )
223 .unwrap()
224});
225
226pub(super) static MITHRIL_TIP_DID_NOT_ADVANCE: LazyLock<IntGaugeVec> = LazyLock::new(|| {
228 register_int_gauge_vec!(
229 format!("follower_mithril_tip_did_not_advance"),
230 "Tip failed to advance",
231 &FOLLOWER_METRIC_LABELS
232 )
233 .unwrap()
234});
235
236pub(super) static MITHRIL_TIP_FAILED_TO_SEND_TO_UPDATER: LazyLock<IntGaugeVec> =
238 LazyLock::new(|| {
239 register_int_gauge_vec!(
240 format!("follower_mithril_tip_failed_to_send_to_updater"),
241 "Failed to send new tip to updater",
242 &FOLLOWER_METRIC_LABELS
243 )
244 .unwrap()
245 });
246
247pub(super) static MITHRIL_FAILED_TO_ACTIVATE_NEW_SNAPSHOT: LazyLock<IntGaugeVec> =
249 LazyLock::new(|| {
250 register_int_gauge_vec!(
251 format!("follower_mithril_failed_to_activate_new_snapshot"),
252 "Failed to activate new snapshot",
253 &FOLLOWER_METRIC_LABELS
254 )
255 .unwrap()
256 });
257
258pub(super) static LIVE_SYNC_START: LazyLock<IntGaugeVec> = LazyLock::new(|| {
262 register_int_gauge_vec!(
263 format!("follower_live_sync_start"),
264 "The Time that synchronization to this blockchain started",
265 &FOLLOWER_METRIC_LABELS
266 )
267 .unwrap()
268});
269
270pub(super) static LIVE_SYNC_END: LazyLock<IntGaugeVec> = LazyLock::new(|| {
273 register_int_gauge_vec!(
274 format!("follower_live_sync_end"),
275 "The Time that synchronization to this blockchain was complete up-to-tip",
276 &FOLLOWER_METRIC_LABELS
277 )
278 .unwrap()
279});
280
281pub(super) static LIVE_BACKFILL_START: LazyLock<IntGaugeVec> = LazyLock::new(|| {
283 register_int_gauge_vec!(
284 format!("follower_live_backfill_start"),
285 "When backfill started",
286 &FOLLOWER_METRIC_LABELS
287 )
288 .unwrap()
289});
290
291pub(super) static LIVE_BACKFILL_SIZE: LazyLock<IntGaugeVec> = LazyLock::new(|| {
293 register_int_gauge_vec!(
294 format!("follower_live_backfill_size"),
295 "Backfill size to achieve synchronization",
296 &FOLLOWER_METRIC_LABELS
297 )
298 .unwrap()
299});
300
301pub(super) static LIVE_BACKFILL_END: LazyLock<IntGaugeVec> = LazyLock::new(|| {
303 register_int_gauge_vec!(
304 format!("follower_live_backfill_end"),
305 "When backfill ended",
306 &FOLLOWER_METRIC_LABELS
307 )
308 .unwrap()
309});
310
311pub(super) static LIVE_BACKFILL_FAILURES: LazyLock<IntGaugeVec> = LazyLock::new(|| {
313 register_int_gauge_vec!(
314 format!("follower_live_backfill_failures"),
315 "Backfill Failures",
316 &FOLLOWER_METRIC_LABELS
317 )
318 .unwrap()
319});
320
321pub(super) static LIVE_BACKFILL_FAILURE_TIME: LazyLock<IntGaugeVec> = LazyLock::new(|| {
323 register_int_gauge_vec!(
324 format!("follower_live_backfill_failure_time"),
325 "The time of the last backfill failure",
326 &FOLLOWER_METRIC_LABELS
327 )
328 .unwrap()
329});
330
331pub(super) static LIVE_BLOCKS: LazyLock<IntGaugeVec> = LazyLock::new(|| {
333 register_int_gauge_vec!(
334 format!("follower_live_blocks"),
335 "Current Number of Live Blocks",
336 &FOLLOWER_METRIC_LABELS
337 )
338 .unwrap()
339});
340
341pub(super) static LIVE_HEAD_SLOT: LazyLock<IntGaugeVec> = LazyLock::new(|| {
343 register_int_gauge_vec!(
344 format!("follower_live_head_slot"),
345 "The current head of the live chain slot#",
346 &FOLLOWER_METRIC_LABELS
347 )
348 .unwrap()
349});
350
351pub(super) static LIVE_TIP: LazyLock<IntGaugeVec> = LazyLock::new(|| {
353 register_int_gauge_vec!(
354 format!("follower_live_tip"),
355 "The current live tip slot# as reported by the peer",
356 &FOLLOWER_METRIC_LABELS
357 )
358 .unwrap()
359});
360
361pub(super) static LIVE_RECONNECTS: LazyLock<IntGaugeVec> = LazyLock::new(|| {
363 register_int_gauge_vec!(
364 format!("follower_live_reconnects"),
365 "Number of times we connected/re-connected to the Node",
366 &FOLLOWER_METRIC_LABELS
367 )
368 .unwrap()
369});
370
371pub(super) static LIVE_LAST_CONNECT: LazyLock<IntGaugeVec> = LazyLock::new(|| {
373 register_int_gauge_vec!(
374 format!("follower_live_last_connect"),
375 "Last reconnect time",
376 &FOLLOWER_METRIC_LABELS
377 )
378 .unwrap()
379});
380
381pub(super) static LIVE_LAST_DISCONNECT: LazyLock<IntGaugeVec> = LazyLock::new(|| {
383 register_int_gauge_vec!(
384 format!("follower_live_last_disconnect"),
385 "Last disconnect time",
386 &FOLLOWER_METRIC_LABELS
387 )
388 .unwrap()
389});
390
391pub(super) static LIVE_CONNECTED: LazyLock<IntGaugeVec> = LazyLock::new(|| {
393 register_int_gauge_vec!(
394 format!("follower_live_connected"),
395 "Is there an active connection to the node",
396 &FOLLOWER_METRIC_LABELS
397 )
398 .unwrap()
399});
400
401pub(super) static LIVE_ROLLBACKS_LIVE_COUNT: LazyLock<IntGaugeVec> = LazyLock::new(|| {
403 register_int_gauge_vec!(
404 format!("follower_live_rollbacks_live_count"),
405 "Number of live chain rollback",
406 &FOLLOWER_METRIC_LABELS
407 )
408 .unwrap()
409});
410
411pub(super) static LIVE_ROLLBACKS_PEER_COUNT: LazyLock<IntGaugeVec> = LazyLock::new(|| {
413 register_int_gauge_vec!(
414 format!("follower_live_rollbacks_peer_count"),
415 "Number of rollbacks reported by the peer node",
416 &FOLLOWER_METRIC_LABELS
417 )
418 .unwrap()
419});
420
421pub(super) static LIVE_ROLLBACKS_FOLLOWER_COUNT: LazyLock<IntGaugeVec> = LazyLock::new(|| {
423 register_int_gauge_vec!(
424 format!("follower_live_rollbacks_follower_count"),
425 "Number of rollbacks synthesized for followers",
426 &FOLLOWER_METRIC_LABELS
427 )
428 .unwrap()
429});
430
431pub(super) static LIVE_NEW_BLOCKS: LazyLock<IntGaugeVec> = LazyLock::new(|| {
433 register_int_gauge_vec!(
434 format!("follower_live_new_blocks"),
435 "New blocks read from blockchain",
436 &FOLLOWER_METRIC_LABELS
437 )
438 .unwrap()
439});
440
441pub(super) static LIVE_INVALID_BLOCKS: LazyLock<IntGaugeVec> = LazyLock::new(|| {
443 register_int_gauge_vec!(
444 format!("follower_live_invalid_blocks"),
445 "Blocks that failed to deserialize from the blockchain",
446 &FOLLOWER_METRIC_LABELS
447 )
448 .unwrap()
449});
450
451pub(super) static LIVE_FOLLOWER_COUNT: LazyLock<IntGaugeVec> = LazyLock::new(|| {
453 register_int_gauge_vec!(
454 format!("follower_live_follower_count"),
455 "Number of active Followers",
456 &FOLLOWER_METRIC_LABELS
457 )
458 .unwrap()
459});