-
Notifications
You must be signed in to change notification settings - Fork 289
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [monitor] update metrics collection (#1651) * block-relayer: Add metrics * block-relayer: Query txn in txpool without load all * Fix up Co-authored-by: suoyuan <suoyuan@gmail.com> Co-authored-by: Guangyu Zhu <guangyuz@gmail.com>
- Loading branch information
1 parent
05704d7
commit 762c69d
Showing
13 changed files
with
88 additions
and
46 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -2,5 +2,5 @@ | |
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
mod block_relayer; | ||
|
||
mod metrics; | ||
pub use block_relayer::BlockRelayer; |
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,37 @@ | ||
use once_cell::sync::Lazy; | ||
use starcoin_metrics::{register_int_gauge, IntGauge, Opts, PrometheusError}; | ||
|
||
pub static BLOCK_RELAYER_METRICS: Lazy<BlockRelayerMetrics> = | ||
Lazy::new(|| BlockRelayerMetrics::register().unwrap()); | ||
|
||
#[derive(Clone)] | ||
pub struct BlockRelayerMetrics { | ||
pub txns_filled_from_network: IntGauge, | ||
pub txns_filled_from_txpool: IntGauge, | ||
pub txns_filled_from_prefill: IntGauge, | ||
} | ||
|
||
impl BlockRelayerMetrics { | ||
pub fn register() -> Result<Self, PrometheusError> { | ||
let txns_filled_from_network = register_int_gauge!(Opts::new( | ||
"txns_filled_from_network", | ||
"Count of block filled transactions from network" | ||
) | ||
.namespace("starcoin"))?; | ||
let txns_filled_from_txpool = register_int_gauge!(Opts::new( | ||
"txns_filled_from_txpool", | ||
"Count of block filled transactions from txpool" | ||
) | ||
.namespace("starcoin"))?; | ||
let txns_filled_from_prefill = register_int_gauge!(Opts::new( | ||
"txns_filled_from_prefill", | ||
"Count of block filled transactions from prefill" | ||
) | ||
.namespace("starcoin"))?; | ||
Ok(Self { | ||
txns_filled_from_network, | ||
txns_filled_from_txpool, | ||
txns_filled_from_prefill, | ||
}) | ||
} | ||
} |
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
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