-
Notifications
You must be signed in to change notification settings - Fork 11.3k
/
Copy pathmetrics.rs
41 lines (37 loc) · 1.17 KB
/
metrics.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
use prometheus::{register_int_gauge_with_registry, IntGauge, Registry};
#[derive(Clone, Debug)]
pub struct WatchdogMetrics {
pub eth_vault_balance: IntGauge,
pub eth_bridge_paused: IntGauge,
pub sui_bridge_paused: IntGauge,
}
impl WatchdogMetrics {
pub fn new(registry: &Registry) -> Self {
Self {
eth_vault_balance: register_int_gauge_with_registry!(
"bridge_eth_vault_balance",
"Current balance of eth vault",
registry,
)
.unwrap(),
eth_bridge_paused: register_int_gauge_with_registry!(
"bridge_eth_bridge_paused",
"Whether the eth bridge is paused",
registry,
)
.unwrap(),
sui_bridge_paused: register_int_gauge_with_registry!(
"bridge_sui_bridge_paused",
"Whether the sui bridge is paused",
registry,
)
.unwrap(),
}
}
pub fn new_for_testing() -> Self {
let registry = Registry::new();
Self::new(®istry)
}
}