sui_core/checkpoints/checkpoint_executor/
metrics.rs1use mysten_metrics::histogram::Histogram as MystenHistogram;
5use prometheus::{
6 Histogram, IntCounter, IntCounterVec, IntGauge, Registry, register_histogram_with_registry,
7 register_int_counter_vec_with_registry, register_int_counter_with_registry,
8 register_int_gauge_with_registry,
9};
10use std::sync::Arc;
11
12pub struct CheckpointExecutorMetrics {
13 pub checkpoint_exec_sync_tps: IntGauge,
14 pub last_executed_checkpoint: IntGauge,
15 pub last_executed_checkpoint_timestamp_ms: IntGauge,
16 pub checkpoint_exec_errors: IntCounter,
17 pub checkpoint_exec_epoch: IntGauge,
18 pub checkpoint_exec_inflight: IntGauge,
19 pub checkpoint_exec_latency: Histogram,
20 pub checkpoint_prepare_latency: Histogram,
21 pub checkpoint_transaction_count: Histogram,
22 pub checkpoint_contents_age: Histogram,
23 pub checkpoint_contents_age_ms: MystenHistogram,
25 pub last_executed_checkpoint_age: Histogram,
26 pub last_executed_checkpoint_age_ms: MystenHistogram,
28 pub checkpoint_executor_validator_path: IntGauge,
29
30 pub stage_wait_duration_ns: IntCounterVec,
31 pub stage_active_duration_ns: IntCounterVec,
32}
33
34impl CheckpointExecutorMetrics {
35 pub fn new(registry: &Registry) -> Arc<Self> {
36 let this = Self {
37 checkpoint_exec_sync_tps: register_int_gauge_with_registry!(
38 "checkpoint_exec_sync_tps",
39 "Checkpoint sync estimated transactions per second",
40 registry
41 )
42 .unwrap(),
43 last_executed_checkpoint: register_int_gauge_with_registry!(
44 "last_executed_checkpoint",
45 "Last executed checkpoint",
46 registry
47 )
48 .unwrap(),
49 last_executed_checkpoint_timestamp_ms: register_int_gauge_with_registry!(
50 "last_executed_checkpoint_timestamp_ms",
51 "Last executed checkpoint timestamp ms",
52 registry
53 )
54 .unwrap(),
55 checkpoint_exec_errors: register_int_counter_with_registry!(
56 "checkpoint_exec_errors",
57 "Checkpoint execution errors count",
58 registry
59 )
60 .unwrap(),
61 checkpoint_exec_epoch: register_int_gauge_with_registry!(
62 "checkpoint_exec_epoch",
63 "Current epoch number in the checkpoint executor",
64 registry
65 )
66 .unwrap(),
67 checkpoint_exec_inflight: register_int_gauge_with_registry!(
68 "checkpoint_exec_inflight",
69 "Current number of inflight checkpoints being executed",
70 registry
71 )
72 .unwrap(),
73 checkpoint_exec_latency: register_histogram_with_registry!(
74 "checkpoint_exec_latency",
75 "Latency of executing a checkpoint from enqueue to all effects available",
76 mysten_metrics::SUBSECOND_LATENCY_SEC_BUCKETS.to_vec(),
77 registry,
78 )
79 .unwrap(),
80 checkpoint_prepare_latency: register_histogram_with_registry!(
81 "checkpoint_prepare_latency",
82 "Latency of preparing a checkpoint to enqueue for execution",
83 mysten_metrics::SUBSECOND_LATENCY_SEC_BUCKETS.to_vec(),
84 registry,
85 )
86 .unwrap(),
87 checkpoint_transaction_count: register_histogram_with_registry!(
88 "checkpoint_transaction_count",
89 "Number of transactions in the checkpoint",
90 mysten_metrics::COUNT_BUCKETS.to_vec(),
91 registry,
92 )
93 .unwrap(),
94 checkpoint_contents_age: register_histogram_with_registry!(
95 "checkpoint_contents_age",
96 "Age of checkpoints when they arrive for execution",
97 mysten_metrics::LATENCY_SEC_BUCKETS.to_vec(),
98 registry,
99 )
100 .unwrap(),
101 checkpoint_contents_age_ms: MystenHistogram::new_in_registry(
102 "checkpoint_contents_age_ms",
103 "Age of checkpoints when they arrive for execution",
104 registry,
105 ),
106 last_executed_checkpoint_age: register_histogram_with_registry!(
107 "last_executed_checkpoint_age",
108 "Age of the last executed checkpoint",
109 mysten_metrics::LATENCY_SEC_BUCKETS.to_vec(),
110 registry
111 )
112 .unwrap(),
113 last_executed_checkpoint_age_ms: MystenHistogram::new_in_registry(
114 "last_executed_checkpoint_age_ms",
115 "Age of the last executed checkpoint",
116 registry,
117 ),
118 checkpoint_executor_validator_path: register_int_gauge_with_registry!(
119 "checkpoint_executor_validator_path",
120 "Number of checkpoints executed using the validator path",
121 registry
122 )
123 .unwrap(),
124 stage_wait_duration_ns: register_int_counter_vec_with_registry!(
125 "checkpoint_executor_pipeline_stage_wait_duration_ns",
126 "Pipeline stage wait duration in nanoseconds",
127 &["stage"],
128 registry,
129 )
130 .unwrap(),
131 stage_active_duration_ns: register_int_counter_vec_with_registry!(
132 "checkpoint_executor_pipeline_stage_active_duration_ns",
133 "Pipeline stage active duration in nanoseconds",
134 &["stage"],
135 registry,
136 )
137 .unwrap(),
138 };
139 Arc::new(this)
140 }
141
142 pub fn new_for_tests() -> Arc<Self> {
143 Self::new(&Registry::new())
144 }
145}