From 495fafb90462e8c397a7b407d1817e1b7a6ad2ff Mon Sep 17 00:00:00 2001 From: Andrew Fitzgerald Date: Tue, 6 Feb 2024 15:03:53 -0800 Subject: [PATCH] update metrics to reflect priority instead of fees - which are not cached --- .../scheduler_controller.rs | 22 ++++++------------- .../transaction_state_container.rs | 2 +- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/core/src/banking_stage/transaction_scheduler/scheduler_controller.rs b/core/src/banking_stage/transaction_scheduler/scheduler_controller.rs index 093a1362f231d4..ec99d36a74ba67 100644 --- a/core/src/banking_stage/transaction_scheduler/scheduler_controller.rs +++ b/core/src/banking_stage/transaction_scheduler/scheduler_controller.rs @@ -103,7 +103,7 @@ impl SchedulerController { // Reset intervals when appropriate, regardless of report. let should_report = self.count_metrics.has_data(); self.count_metrics - .update_prioritization_stats(self.container.get_min_max_prioritization_fees()); + .update_priority_stats(self.container.get_min_max_priority()); self.count_metrics.maybe_report_and_reset(should_report); self.timing_metrics.maybe_report_and_reset(should_report); self.worker_metrics @@ -527,16 +527,8 @@ impl SchedulerCountMetrics { i64 ), ("num_dropped_on_capacity", self.num_dropped_on_capacity, i64), - ( - "min_prioritization_fees", - self.get_min_prioritization_fees(), - i64 - ), - ( - "max_prioritization_fees", - self.get_max_prioritization_fees(), - i64 - ) + ("min_priority", self.get_min_priority(), i64), + ("max_priority", self.get_max_priority(), i64) ); } @@ -576,8 +568,8 @@ impl SchedulerCountMetrics { self.max_prioritization_fees = 0; } - pub fn update_prioritization_stats(&mut self, min_max_fees: MinMaxResult) { - // update min/max priotization fees + pub fn update_priority_stats(&mut self, min_max_fees: MinMaxResult) { + // update min/max priority match min_max_fees { itertools::MinMaxResult::NoElements => { // do nothing @@ -593,7 +585,7 @@ impl SchedulerCountMetrics { } } - pub fn get_min_prioritization_fees(&self) -> u64 { + pub fn get_min_priority(&self) -> u64 { // to avoid getting u64::max recorded by metrics / in case of edge cases if self.min_prioritization_fees != u64::MAX { self.min_prioritization_fees @@ -602,7 +594,7 @@ impl SchedulerCountMetrics { } } - pub fn get_max_prioritization_fees(&self) -> u64 { + pub fn get_max_priority(&self) -> u64 { self.max_prioritization_fees } } diff --git a/core/src/banking_stage/transaction_scheduler/transaction_state_container.rs b/core/src/banking_stage/transaction_scheduler/transaction_state_container.rs index a36df25fccdcf3..a627375a03e6ba 100644 --- a/core/src/banking_stage/transaction_scheduler/transaction_state_container.rs +++ b/core/src/banking_stage/transaction_scheduler/transaction_state_container.rs @@ -144,7 +144,7 @@ impl TransactionStateContainer { .expect("transaction must exist"); } - pub(crate) fn get_min_max_prioritization_fees(&self) -> MinMaxResult { + pub(crate) fn get_min_max_priority(&self) -> MinMaxResult { match self.priority_queue.peek_min() { Some(min) => match self.priority_queue.peek_max() { Some(max) => MinMaxResult::MinMax(min.priority, max.priority),