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

fix: expose min_peer_rps metric from CeramicNewStreamsBenchmark #157

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Changes from all commits
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
15 changes: 13 additions & 2 deletions runner/src/simulate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ impl ScenarioState {

/// For now, most scenarios are successful if they complete without error and only EventIdSync has a criteria.
/// Not a result to ensure we always proceed with cleanup, even if we fail to validate the scenario.
/// Should return the Minimum RPS of all peers as the f64
pub async fn validate_scenario_success(
&self,
metrics: &GooseMetrics,
Expand All @@ -383,8 +384,12 @@ impl ScenarioState {
}
let target = self.target_request_rate.unwrap_or(300);
let mut errors = vec![];
let mut min = f64::INFINITY;
for (worker_id, count) in res {
let rps = count as f64 / metrics.duration as f64;
if rps < min {
min = rps;
}
if rps < target as f64 {
let msg = format!(
"Worker {} did not meet the target request rate: {} < {} (total requests: {} over {})",
Expand All @@ -396,10 +401,15 @@ impl ScenarioState {
info!("worker {} met threshold! {} > {}", worker_id, rps, target);
}
}
let min = if min == f64::INFINITY {
None
} else {
Some(min)
};
if errors.is_empty() {
(CommandResult::Success, None)
(CommandResult::Success, min)
} else {
(CommandResult::Failure(anyhow!(errors.join("\n"))), None)
(CommandResult::Failure(anyhow!(errors.join("\n"))), min)
}
}
Scenario::ReconEventSync | Scenario::ReconEventKeySync => {
Expand Down Expand Up @@ -430,6 +440,7 @@ impl ScenarioState {
}

/// Removed from `validate_scenario_success` to make testing easier as constructing the GooseMetrics appropriately is difficult
/// Should return the Minimum RPS of all peers as the f64
async fn validate_recon_scenario_success_int(
&self,
run_time_seconds: u64,
Expand Down
Loading