-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(starknet_batcher): storage height metric
- Loading branch information
1 parent
034a3d0
commit 308287b
Showing
6 changed files
with
71 additions
and
5 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
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,19 @@ | ||
use metrics::{counter, describe_counter}; | ||
use starknet_api::block::BlockNumber; | ||
|
||
pub const STORAGE_HEIGHT: Metric = | ||
Metric { name: "batcher_storage_height", description: "The height of the batcher storage" }; | ||
|
||
pub struct Metric { | ||
pub name: &'static str, | ||
pub description: &'static str, | ||
} | ||
|
||
pub fn register_metrics(storage_height: BlockNumber) { | ||
// Ideally, we would have a `Gauge` here because of reverts, but we can't because | ||
// the value will need to implement `Into<f64>` and `BlockNumber` doesn't. | ||
// In case of reverts, consider calling `absolute`. | ||
let storage_height_metric = counter!(STORAGE_HEIGHT.name); | ||
describe_counter!(STORAGE_HEIGHT.name, STORAGE_HEIGHT.description); | ||
storage_height_metric.absolute(storage_height.0); | ||
} |