mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 11:01:01 +00:00
grandpa: filter some telemetry events on larger voter sets (#4700)
This commit is contained in:
committed by
Bastian Köcher
parent
9d556a69ef
commit
c1750c5c28
@@ -106,6 +106,11 @@ mod benefit {
|
|||||||
pub(super) const PER_EQUIVOCATION: i32 = 10;
|
pub(super) const PER_EQUIVOCATION: i32 = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// If the voter set is larger than this value some telemetry events are not
|
||||||
|
/// sent to avoid increasing usage resource on the node and flooding the
|
||||||
|
/// telemetry server (e.g. received votes, received commits.)
|
||||||
|
const TELEMETRY_VOTERS_LIMIT: usize = 10;
|
||||||
|
|
||||||
/// A handle to the network.
|
/// A handle to the network.
|
||||||
///
|
///
|
||||||
/// Something that provides both the capabilities needed for the `gossip_network::Network` trait as
|
/// Something that provides both the capabilities needed for the `gossip_network::Network` trait as
|
||||||
@@ -308,6 +313,7 @@ impl<B: BlockT, N: Network<B>> NetworkBridge<B, N> {
|
|||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if voters.len() <= TELEMETRY_VOTERS_LIMIT {
|
||||||
match &msg.message.message {
|
match &msg.message.message {
|
||||||
PrimaryPropose(propose) => {
|
PrimaryPropose(propose) => {
|
||||||
telemetry!(CONSENSUS_INFO; "afg.received_propose";
|
telemetry!(CONSENSUS_INFO; "afg.received_propose";
|
||||||
@@ -331,6 +337,7 @@ impl<B: BlockT, N: Network<B>> NetworkBridge<B, N> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
Ok(Some(msg.message))
|
Ok(Some(msg.message))
|
||||||
}
|
}
|
||||||
@@ -474,11 +481,13 @@ fn incoming_global<B: BlockT>(
|
|||||||
format!("{}", a)
|
format!("{}", a)
|
||||||
}).collect();
|
}).collect();
|
||||||
|
|
||||||
|
if voters.len() <= TELEMETRY_VOTERS_LIMIT {
|
||||||
telemetry!(CONSENSUS_INFO; "afg.received_commit";
|
telemetry!(CONSENSUS_INFO; "afg.received_commit";
|
||||||
"contains_precommits_signed_by" => ?precommits_signed_by,
|
"contains_precommits_signed_by" => ?precommits_signed_by,
|
||||||
"target_number" => ?msg.message.target_number.clone(),
|
"target_number" => ?msg.message.target_number.clone(),
|
||||||
"target_hash" => ?msg.message.target_hash.clone(),
|
"target_hash" => ?msg.message.target_hash.clone(),
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if let Err(cost) = check_compact_commit::<B>(
|
if let Err(cost) = check_compact_commit::<B>(
|
||||||
&msg.message,
|
&msg.message,
|
||||||
|
|||||||
Reference in New Issue
Block a user