mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
feat: add metrics for highest pruned block per segment (#6658)
Co-authored-by: Roman Krasiuk <rokrassyuk@gmail.com>
This commit is contained in:
committed by
GitHub
parent
477a0185e2
commit
7cb9eaea9c
@ -1,4 +1,7 @@
|
|||||||
use reth_metrics::{metrics::Histogram, Metrics};
|
use reth_metrics::{
|
||||||
|
metrics::{Gauge, Histogram},
|
||||||
|
Metrics,
|
||||||
|
};
|
||||||
use reth_primitives::PruneSegment;
|
use reth_primitives::PruneSegment;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
@ -29,4 +32,6 @@ impl Metrics {
|
|||||||
pub(crate) struct PrunerSegmentMetrics {
|
pub(crate) struct PrunerSegmentMetrics {
|
||||||
/// Pruning duration for this segment
|
/// Pruning duration for this segment
|
||||||
pub(crate) duration_seconds: Histogram,
|
pub(crate) duration_seconds: Histogram,
|
||||||
|
/// Highest pruned block per segment
|
||||||
|
pub(crate) highest_pruned_block: Gauge,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -140,6 +140,11 @@ impl<DB: Database> Pruner<DB> {
|
|||||||
.duration_seconds
|
.duration_seconds
|
||||||
.record(segment_start.elapsed());
|
.record(segment_start.elapsed());
|
||||||
|
|
||||||
|
self.metrics
|
||||||
|
.get_prune_segment_metrics(segment.segment())
|
||||||
|
.highest_pruned_block
|
||||||
|
.set(to_block as f64);
|
||||||
|
|
||||||
done = done && output.done;
|
done = done && output.done;
|
||||||
delete_limit = delete_limit.saturating_sub(output.pruned);
|
delete_limit = delete_limit.saturating_sub(output.pruned);
|
||||||
stats.insert(
|
stats.insert(
|
||||||
|
|||||||
Reference in New Issue
Block a user