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}
21
22impl ObjectFundsCheckerMetrics {
23 pub fn new(registry: &Registry) -> Self {
24 Self {
25 highest_settled_version: register_int_gauge_with_registry!(
26 "object_funds_highest_settled_version",
27 "Highest settled accumulator version",
28 registry,
29 )
30 .unwrap(),
31 pending_checks: register_int_gauge_with_registry!(
32 "object_funds_pending_checks",
33 "Number of pending unresolved object funds checks",
34 registry,
35 )
36 .unwrap(),
37 pending_check_latency: register_histogram_with_registry!(
38 "object_funds_pending_check_latency",
39 "Latency in seconds from pending check creation to resolution",
40 SCHEDULING_LATENCY_SEC_BUCKETS.to_vec(),
41 registry,
42 )
43 .unwrap(),
44 unsettled_accounts: register_int_gauge_with_registry!(
45 "object_funds_unsettled_accounts",
46 "Number of accounts with unsettled withdraws",
47 registry,
48 )
49 .unwrap(),
50 unsettled_versions: register_int_gauge_with_registry!(
51 "object_funds_unsettled_versions",
52 "Number of versions with unsettled accounts",
53 registry,
54 )
55 .unwrap(),
56 check_result: register_int_counter_vec_with_registry!(
57 "object_funds_check_result",
58 "Count of object funds check results by outcome",
59 &["result"],
60 registry,
61 )
62 .unwrap(),
63 }
64 }
65}