mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 05:07:55 +00:00
Add more metrics to the import queue (#7207)
This commit is contained in:
@@ -292,6 +292,7 @@ impl<B: BlockT, Transaction: Send> BlockImportWorker<B, Transaction> {
|
||||
number: NumberFor<B>,
|
||||
finality_proof: Vec<u8>
|
||||
) {
|
||||
let started = wasm_timer::Instant::now();
|
||||
let result = self.finality_proof_import.as_mut().map(|finality_proof_import| {
|
||||
finality_proof_import.import_finality_proof(hash, number, finality_proof, verifier)
|
||||
.map_err(|e| {
|
||||
@@ -305,6 +306,10 @@ impl<B: BlockT, Transaction: Send> BlockImportWorker<B, Transaction> {
|
||||
})
|
||||
}).unwrap_or(Err(()));
|
||||
|
||||
if let Some(metrics) = self.metrics.as_ref() {
|
||||
metrics.finality_proof_import_time.observe(started.elapsed().as_secs_f64());
|
||||
}
|
||||
|
||||
trace!(target: "sync", "Imported finality proof for {}/{}", number, hash);
|
||||
self.result_sender.finality_proof_imported(who, (hash, number), result);
|
||||
}
|
||||
@@ -316,6 +321,7 @@ impl<B: BlockT, Transaction: Send> BlockImportWorker<B, Transaction> {
|
||||
number: NumberFor<B>,
|
||||
justification: Justification
|
||||
) {
|
||||
let started = wasm_timer::Instant::now();
|
||||
let success = self.justification_import.as_mut().map(|justification_import| {
|
||||
justification_import.import_justification(hash, number, justification)
|
||||
.map_err(|e| {
|
||||
@@ -331,6 +337,10 @@ impl<B: BlockT, Transaction: Send> BlockImportWorker<B, Transaction> {
|
||||
}).is_ok()
|
||||
}).unwrap_or(false);
|
||||
|
||||
if let Some(metrics) = self.metrics.as_ref() {
|
||||
metrics.justification_import_time.observe(started.elapsed().as_secs_f64());
|
||||
}
|
||||
|
||||
self.result_sender.justification_imported(who, &hash, number, success);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user