report received message signatures only on PUSH requests (#32708)

* we only want to report received message signatures on PUSH requests, not PULL requests

* woops accidently had it has LocalMessage not PushMessage

* switch from match to if let statement

* convert if let to matches macro
This commit is contained in:
Greg Cusack 2023-08-06 20:36:23 -07:00 committed by GitHub
parent dbe6d0353f
commit 849525735f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View File

@ -669,7 +669,7 @@ impl Default for CrdsDataStats {
}
impl CrdsDataStats {
fn record_insert(&mut self, entry: &VersionedCrdsValue) {
fn record_insert(&mut self, entry: &VersionedCrdsValue, route: GossipRoute) {
self.counts[Self::ordinal(entry)] += 1;
if let CrdsData::Vote(_, vote) = &entry.value.data {
if let Some(slot) = vote.slot() {
@ -678,7 +678,9 @@ impl CrdsDataStats {
}
}
if should_report_message_signature(&entry.value.signature) {
if matches!(route, GossipRoute::PushMessage)
&& should_report_message_signature(&entry.value.signature)
{
datapoint_info!(
"gossip_crds_sample",
(
@ -723,8 +725,8 @@ impl CrdsStats {
match route {
GossipRoute::LocalMessage => (),
GossipRoute::PullRequest => (),
GossipRoute::PushMessage => self.push.record_insert(entry),
GossipRoute::PullResponse => self.pull.record_insert(entry),
GossipRoute::PushMessage => self.push.record_insert(entry, route),
GossipRoute::PullResponse => self.pull.record_insert(entry, route),
}
}