sui_core/accumulators/object_funds_checker/
metrics.rs1use prometheus::{
5 Histogram, IntCounterVec, IntGauge, Registry, register_histogram_with_registry,
6 register_int_counter_vec_with_registry, register_int_gauge_with_registry,
7};
8
9const SCHEDULING_LATENCY_SEC_BUCKETS: &[f64] = &[
10 0.001, 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1.0, 2.5, 5.0, 10.0, 30.0, 60.0,
11];
12
13pub struct ObjectFundsCheckerMetrics {
14 pub highest_settled_version: IntGauge,
15 pub pending_checks: IntGauge,
16 pub pending_check_latency: Histogram,
17 pub unsettled_accounts: IntGauge,
18 pub unsettled_versions: IntGauge,
19 pub check_result: IntCounterVec,
20 pub in_execution_check_result: IntCounterVec,
21}
22
23impl ObjectFundsCheckerMetrics {
24 pub fn new(registry: &Registry) -> Self {
25 Self {
26 highest_settled_version: register_int_gauge_with_registry!(
27 "object_funds_highest_settled_version",
28 "Highest settled accumulator version",
29 registry,
30 )
31 .unwrap(),
32 pending_checks: register_int_gauge_with_registry!(
33 "object_funds_pending_checks",
34 "Number of pending unresolved object funds checks",
35 registry,
36 )
37 .unwrap(),
38 pending_check_latency: register_histogram_with_registry!(
39 "object_funds_pending_check_latency",
40 "Latency in seconds from pending check creation to resolution",
41 SCHEDULING_LATENCY_SEC_BUCKETS.to_vec(),
42 registry,
43 )
44 .unwrap(),
45 unsettled_accounts: register_int_gauge_with_registry!(
46 "object_funds_unsettled_accounts",
47 "Number of accounts with unsettled withdraws",
48 registry,
49 )
50 .unwrap(),
51 unsettled_versions: register_int_gauge_with_registry!(
52 "object_funds_unsettled_versions",
53 "Number of versions with unsettled accounts",
54 registry,
55 )
56 .unwrap(),
57 check_result: register_int_counter_vec_with_registry!(
58 "object_funds_check_result",
59 "Count of object funds check results by outcome",
60 &["result"],
61 registry,
62 )
63 .unwrap(),
64 in_execution_check_result: register_int_counter_vec_with_registry!(
65 "object_funds_in_execution_check_result",
66 "Count of committed in-execution object funds check outcomes by result",
67 &["result"],
68 registry,
69 )
70 .unwrap(),
71 }
72 }
73}