forked from MystenLabs/sui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial metrics work for the indexer (MystenLabs#18025)
## Description Initial work for monitoring values. This is a good start for values to track and please advise on what else you'd like to see. ## Test plan Not much now and need to come up with something to check that things are good --- ## Release notes Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required. For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] Indexer: - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK:
- Loading branch information
1 parent
b7b6dfc
commit f1a2d61
Showing
6 changed files
with
164 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use prometheus::{register_int_counter_with_registry, IntCounter, Registry}; | ||
|
||
#[derive(Clone)] | ||
pub struct BridgeIndexerMetrics { | ||
pub(crate) total_sui_bridge_transactions: IntCounter, | ||
pub(crate) total_sui_token_deposited: IntCounter, | ||
pub(crate) total_sui_token_transfer_approved: IntCounter, | ||
pub(crate) total_sui_token_transfer_claimed: IntCounter, | ||
pub(crate) total_sui_bridge_txn_other: IntCounter, | ||
pub(crate) total_eth_bridge_transactions: IntCounter, | ||
pub(crate) total_eth_token_deposited: IntCounter, | ||
pub(crate) total_eth_token_transfer_claimed: IntCounter, | ||
pub(crate) total_eth_bridge_txn_other: IntCounter, | ||
} | ||
|
||
impl BridgeIndexerMetrics { | ||
pub fn new(registry: &Registry) -> Self { | ||
Self { | ||
total_sui_bridge_transactions: register_int_counter_with_registry!( | ||
"total_sui_bridge_transactions", | ||
"Total number of sui bridge transactions", | ||
registry, | ||
) | ||
.unwrap(), | ||
total_sui_token_deposited: register_int_counter_with_registry!( | ||
"total_sui_token_deposited", | ||
"Total number of sui token deposited transactions", | ||
registry, | ||
) | ||
.unwrap(), | ||
total_sui_token_transfer_approved: register_int_counter_with_registry!( | ||
"total_sui_token_transfer_approved", | ||
"Total number of sui token approved transactions", | ||
registry, | ||
) | ||
.unwrap(), | ||
total_sui_token_transfer_claimed: register_int_counter_with_registry!( | ||
"total_sui_token_transfer_claimed", | ||
"Total number of sui token claimed transactions", | ||
registry, | ||
) | ||
.unwrap(), | ||
total_sui_bridge_txn_other: register_int_counter_with_registry!( | ||
"total_sui_bridge_txn_other", | ||
"Total number of other sui bridge transactions", | ||
registry, | ||
) | ||
.unwrap(), | ||
total_eth_bridge_transactions: register_int_counter_with_registry!( | ||
"total_eth_bridge_transactions", | ||
"Total number of eth bridge transactions", | ||
registry, | ||
) | ||
.unwrap(), | ||
total_eth_token_deposited: register_int_counter_with_registry!( | ||
"total_eth_token_deposited", | ||
"Total number of eth token deposited transactions", | ||
registry, | ||
) | ||
.unwrap(), | ||
total_eth_token_transfer_claimed: register_int_counter_with_registry!( | ||
"total_eth_token_transfer_claimed", | ||
"Total number of eth token claimed transactions", | ||
registry, | ||
) | ||
.unwrap(), | ||
total_eth_bridge_txn_other: register_int_counter_with_registry!( | ||
"total_eth_bridge_txn_other", | ||
"Total number of other eth bridge transactions", | ||
registry, | ||
) | ||
.unwrap(), | ||
} | ||
} | ||
|
||
pub fn new_for_testing() -> Self { | ||
let registry = Registry::new(); | ||
Self::new(®istry) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters