Skip to content

Commit

Permalink
update metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
esemeniuc committed Dec 4, 2023
1 parent 275c062 commit 993f46a
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions core/src/bundle_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,24 +100,24 @@ impl BundleStageLoopMetrics {
.fetch_add(count, Ordering::Relaxed);
}

pub fn increment_current_buffered_bundles_count(&mut self, count: u64) {
pub fn set_current_buffered_bundles_count(&mut self, count: u64) {
self.current_buffered_bundles_count
.fetch_add(count, Ordering::Relaxed);
.store(count, Ordering::Relaxed);
}

pub fn increment_current_buffered_packets_count(&mut self, count: u64) {
pub fn set_current_buffered_packets_count(&mut self, count: u64) {
self.current_buffered_packets_count
.fetch_add(count, Ordering::Relaxed);
.store(count, Ordering::Relaxed);
}

pub fn increment_cost_model_buffered_bundles_count(&mut self, count: u64) {
pub fn set_cost_model_buffered_bundles_count(&mut self, count: u64) {
self.cost_model_buffered_bundles_count
.fetch_add(count, Ordering::Relaxed);
.store(count, Ordering::Relaxed);
}

pub fn increment_cost_model_buffered_packets_count(&mut self, count: u64) {
pub fn set_cost_model_buffered_packets_count(&mut self, count: u64) {
self.cost_model_buffered_packets_count
.fetch_add(count, Ordering::Relaxed);
.store(count, Ordering::Relaxed);
}

pub fn increment_num_bundles_dropped(&mut self, count: u64) {
Expand Down Expand Up @@ -381,16 +381,14 @@ impl BundleStage {
}

let bundle_storage = unprocessed_bundle_storage.bundle_storage().unwrap();
bundle_stage_metrics.increment_current_buffered_bundles_count(
bundle_storage.unprocessed_bundles_len() as u64,
);
bundle_stage_metrics.increment_current_buffered_packets_count(
bundle_storage.unprocessed_packets_len() as u64,
);
bundle_stage_metrics.increment_cost_model_buffered_bundles_count(
bundle_stage_metrics
.set_current_buffered_bundles_count(bundle_storage.unprocessed_bundles_len() as u64);
bundle_stage_metrics
.set_current_buffered_packets_count(bundle_storage.unprocessed_packets_len() as u64);
bundle_stage_metrics.set_cost_model_buffered_bundles_count(
bundle_storage.cost_model_buffered_bundles_len() as u64,
);
bundle_stage_metrics.increment_cost_model_buffered_packets_count(
bundle_stage_metrics.set_cost_model_buffered_packets_count(
bundle_storage.cost_model_buffered_packets_len() as u64,
);
bundle_stage_metrics.maybe_report(1_000);
Expand Down

0 comments on commit 993f46a

Please sign in to comment.