|
@@ -16,6 +16,11 @@ pub struct AccountLabel {
|
|
|
pub address: String,
|
|
pub address: String,
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+#[derive(Clone, Debug, Hash, PartialEq, Eq, EncodeLabelSet)]
|
|
|
|
|
+pub struct ChainIdLabel {
|
|
|
|
|
+ pub chain_id: String,
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
pub struct KeeperMetrics {
|
|
pub struct KeeperMetrics {
|
|
|
pub current_sequence_number: Family<AccountLabel, Gauge>,
|
|
pub current_sequence_number: Family<AccountLabel, Gauge>,
|
|
|
pub end_sequence_number: Family<AccountLabel, Gauge>,
|
|
pub end_sequence_number: Family<AccountLabel, Gauge>,
|
|
@@ -36,6 +41,7 @@ pub struct KeeperMetrics {
|
|
|
pub final_gas_multiplier: Family<AccountLabel, Histogram>,
|
|
pub final_gas_multiplier: Family<AccountLabel, Histogram>,
|
|
|
pub final_fee_multiplier: Family<AccountLabel, Histogram>,
|
|
pub final_fee_multiplier: Family<AccountLabel, Histogram>,
|
|
|
pub gas_price_estimate: Family<AccountLabel, Gauge<f64, AtomicU64>>,
|
|
pub gas_price_estimate: Family<AccountLabel, Gauge<f64, AtomicU64>>,
|
|
|
|
|
+ pub accrued_pyth_fees: Family<ChainIdLabel, Gauge<f64, AtomicU64>>,
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
impl Default for KeeperMetrics {
|
|
impl Default for KeeperMetrics {
|
|
@@ -76,6 +82,7 @@ impl Default for KeeperMetrics {
|
|
|
Histogram::new(vec![100.0, 110.0, 120.0, 140.0, 160.0, 180.0, 200.0].into_iter())
|
|
Histogram::new(vec![100.0, 110.0, 120.0, 140.0, 160.0, 180.0, 200.0].into_iter())
|
|
|
}),
|
|
}),
|
|
|
gas_price_estimate: Family::default(),
|
|
gas_price_estimate: Family::default(),
|
|
|
|
|
+ accrued_pyth_fees: Family::default(),
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -202,9 +209,25 @@ impl KeeperMetrics {
|
|
|
keeper_metrics.gas_price_estimate.clone(),
|
|
keeper_metrics.gas_price_estimate.clone(),
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
|
|
+ writable_registry.register(
|
|
|
|
|
+ "accrued_pyth_fees",
|
|
|
|
|
+ "Accrued Pyth fees on the contract",
|
|
|
|
|
+ keeper_metrics.accrued_pyth_fees.clone(),
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
// *Important*: When adding a new metric:
|
|
// *Important*: When adding a new metric:
|
|
|
// 1. Register it above using `writable_registry.register(...)`
|
|
// 1. Register it above using `writable_registry.register(...)`
|
|
|
// 2. Add a get_or_create call in the loop below to initialize it for each chain/provider pair
|
|
// 2. Add a get_or_create call in the loop below to initialize it for each chain/provider pair
|
|
|
|
|
+
|
|
|
|
|
+ // Initialize accrued_pyth_fees for each chain_id
|
|
|
|
|
+ for (chain_id, _) in chain_labels.iter() {
|
|
|
|
|
+ let _ = keeper_metrics
|
|
|
|
|
+ .accrued_pyth_fees
|
|
|
|
|
+ .get_or_create(&ChainIdLabel {
|
|
|
|
|
+ chain_id: chain_id.clone(),
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
for (chain_id, provider_address) in chain_labels {
|
|
for (chain_id, provider_address) in chain_labels {
|
|
|
let account_label = AccountLabel {
|
|
let account_label = AccountLabel {
|
|
|
chain_id,
|
|
chain_id,
|