Snapshot manifest block added to prometheus (#232)

Co-authored-by: adria0.eth <5526331+adria0@users.noreply.github.com>
This commit is contained in:
rakita
2021-01-21 17:23:15 +01:00
committed by GitHub
parent f3bdc0da3c
commit 59d891edf4
5 changed files with 30 additions and 0 deletions

View File

@@ -406,6 +406,11 @@ impl PrometheusMetrics for EthSync {
let restoration = self.eth_handler.snapshot_service.restoration_status();
let creation = self.eth_handler.snapshot_service.creation_status();
let (manifest_block_num, _) = self
.eth_handler
.snapshot_service
.manifest_block()
.unwrap_or((0, H256::zero()));
prometheus_gauge(
r,
@@ -427,6 +432,12 @@ impl PrometheusMetrics for EthSync {
0
},
);
prometheus_gauge(
r,
"snapshot_manifest_block",
"First block number of the present snapshot",
manifest_block_num as i64,
);
}
}

View File

@@ -89,6 +89,12 @@ impl SnapshotService for TestSnapshotService {
self.manifest.as_ref().cloned()
}
fn manifest_block(&self) -> Option<(u64, H256)> {
self.manifest
.as_ref()
.map(|manifest| (manifest.block_number, manifest.block_hash))
}
fn supported_versions(&self) -> Option<(u64, u64)> {
Some((1, 2))
}