Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report ConsumeWorkerMetrics at slot transitions #3212

Merged
merged 5 commits into from
Oct 24, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/src/banking_stage/consume_worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ impl ConsumeWorkerMetrics {
/// a) (when a leader) Previous slot is not the same as current.
/// b) (when not a leader) report the metrics accumulated so far.
pub fn maybe_report_and_reset(&self, slot: Option<Slot>) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function may be called more than once per leader slot.
we need to check that the slot is different than the cached slot before resetting has_data

let prev_slot_id: u64 = self.slot.load(Ordering::Relaxed);
if let Some(slot) = slot {
let prev_slot_id: u64 = self.slot.load(Ordering::Relaxed);
if slot != prev_slot_id {
if !self.has_data.swap(false, Ordering::Relaxed) {
return;
Expand All @@ -194,7 +194,7 @@ impl ConsumeWorkerMetrics {
self.error_metrics.report_and_reset(&self.id);
self.slot.swap(slot, Ordering::Relaxed);
}
} else {
} else if prev_slot_id != 0 {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to reset self.slot in here. otherwise it will still spam.

You should start up a test validator and check logs. It should not report more than once per slot.

self.count_metrics.report_and_reset(&self.id);
self.timing_metrics.report_and_reset(&self.id);
self.error_metrics.report_and_reset(&self.id);
Expand Down
Loading