This repository has been archived by the owner on Aug 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 291
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added prometheus metrics for blocks (#1529)
- Loading branch information
1 parent
943f323
commit 5c33ec9
Showing
7 changed files
with
82 additions
and
3 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use prometheus_endpoint::prometheus::{Counter, Gauge}; | ||
use prometheus_endpoint::{register, PrometheusError, Registry}; | ||
|
||
#[derive(Clone, Debug)] | ||
pub struct BlockMetrics { | ||
pub block_height: Gauge, | ||
pub transaction_count: Counter, | ||
pub event_count: Counter, | ||
pub l1_gas_price_wei: Gauge, | ||
pub l1_gas_price_strk: Gauge, | ||
} | ||
|
||
impl BlockMetrics { | ||
pub fn register(registry: &Registry) -> Result<Self, PrometheusError> { | ||
Ok(Self { | ||
block_height: register(Gauge::new("madara_block_height", "Gauge for madara block height")?, registry)?, | ||
transaction_count: register( | ||
Counter::new("madara_transaction_count", "Counter for madara transaction count")?, | ||
registry, | ||
)?, | ||
event_count: register(Counter::new("madara_event_count", "Counter for madara event count")?, registry)?, | ||
l1_gas_price_wei: register(Gauge::new("madara_l1_gas_price", "Gauge for madara l1 gas price")?, registry)?, | ||
l1_gas_price_strk: register( | ||
Gauge::new("madara_l1_gas_price_strk", "Gauge for madara l1 gas price in strk")?, | ||
registry, | ||
)?, | ||
}) | ||
} | ||
} |
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