-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/alexey/pruner-account-history' i…
…nto alexey/pruner-storage-history
- Loading branch information
Showing
7 changed files
with
65 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
mod error; | ||
mod metrics; | ||
mod pruner; | ||
|
||
pub use error::PrunerError; | ||
use metrics::Metrics; | ||
pub use pruner::{BatchSizes, Pruner, PrunerResult, PrunerWithResult}; |
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,36 @@ | ||
use reth_metrics::{metrics, metrics::Histogram, Metrics}; | ||
use reth_primitives::PrunePart; | ||
use std::collections::HashMap; | ||
|
||
#[derive(Debug, Default)] | ||
pub(crate) struct Metrics { | ||
pub(crate) pruner: PrunerMetrics, | ||
prune_parts: HashMap<PrunePart, PrunerPartMetrics>, | ||
} | ||
|
||
impl Metrics { | ||
/// Returns existing or initializes a new instance of [PrunerPartMetrics] for the provided | ||
/// [PrunePart]. | ||
pub(crate) fn get_prune_part_metrics( | ||
&mut self, | ||
prune_part: PrunePart, | ||
) -> &mut PrunerPartMetrics { | ||
self.prune_parts.entry(prune_part).or_insert_with(|| { | ||
PrunerPartMetrics::new_with_labels(&[("part", prune_part.to_string())]) | ||
}) | ||
} | ||
} | ||
|
||
#[derive(Metrics)] | ||
#[metrics(scope = "pruner")] | ||
pub(crate) struct PrunerMetrics { | ||
/// Pruning duration | ||
pub(crate) duration_seconds: Histogram, | ||
} | ||
|
||
#[derive(Metrics)] | ||
#[metrics(scope = "pruner.parts")] | ||
pub(crate) struct PrunerPartMetrics { | ||
/// Pruning duration for this part | ||
pub(crate) duration_seconds: Histogram, | ||
} |
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