mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-29 17:17:56 +00:00
Add metrics for out of view statement distribution errors (#4972)
* Add a simple metric for statements out-of-view * Avoid repeated out-of-view peer reputation change messages * Log reporting status * Address review comments * Use counter to store a number of unexpected messages from a peer * Distinguish different unexpected statements in the metrics * Fix labels cardinality * Rename metric name to `statements_unexpected` * Move metrics to a separate unit, avoid unnecessary enum * Prefer specific methods in lieu of public constants
This commit is contained in:
@@ -32,7 +32,7 @@ use polkadot_node_subsystem_util::TimeoutExt;
|
||||
use polkadot_primitives::v1::{CandidateHash, CommittedCandidateReceipt, Hash};
|
||||
use polkadot_subsystem::{Span, Stage};
|
||||
|
||||
use crate::{Metrics, COST_WRONG_HASH, LOG_TARGET};
|
||||
use crate::{metrics::Metrics, COST_WRONG_HASH, LOG_TARGET};
|
||||
|
||||
// In case we failed fetching from our known peers, how long we should wait before attempting a
|
||||
// retry, even though we have not yet discovered any new peers. Or in other words how long to
|
||||
@@ -117,6 +117,7 @@ pub async fn fetch(
|
||||
Ok(StatementFetchingResponse::Statement(statement)) => {
|
||||
if statement.hash() != candidate_hash {
|
||||
metrics.on_received_response(false);
|
||||
metrics.on_unexpected_statement_large();
|
||||
|
||||
if let Err(err) =
|
||||
sender.feed(RequesterMessage::ReportPeer(peer, COST_WRONG_HASH)).await
|
||||
@@ -161,6 +162,7 @@ pub async fn fetch(
|
||||
);
|
||||
|
||||
metrics.on_received_response(false);
|
||||
metrics.on_unexpected_statement_large();
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user