-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[api] Add individual step timing to api tester (#9502)
This commit builds individual step timing on top of the consistent API testing introduced here. See proposal for more high level information. This addition allows us to dive deeper on what the issue is should we detect any flow is consistently slower. Changes: Add timer macro in macros.rs. Add helpers for emitting metrics and refactor process_result. Put publish_module in its own thread by creating a tokio runtime. Add sleeps between persistent checks. Reduce API client sleep time to 100ms from 500ms. Make test setups persistent.
- Loading branch information
Showing
21 changed files
with
965 additions
and
457 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Copyright © Aptos Foundation | ||
|
||
use once_cell::sync::Lazy; | ||
use std::{env, time::Duration}; | ||
use url::Url; | ||
|
||
// Node and faucet constants | ||
|
||
pub static DEVNET_NODE_URL: Lazy<Url> = | ||
Lazy::new(|| Url::parse("https://fullnode.devnet.aptoslabs.com").unwrap()); | ||
|
||
pub static DEVNET_FAUCET_URL: Lazy<Url> = | ||
Lazy::new(|| Url::parse("https://faucet.devnet.aptoslabs.com").unwrap()); | ||
|
||
pub static TESTNET_NODE_URL: Lazy<Url> = | ||
Lazy::new(|| Url::parse("https://fullnode.testnet.aptoslabs.com").unwrap()); | ||
|
||
pub static TESTNET_FAUCET_URL: Lazy<Url> = | ||
Lazy::new(|| Url::parse("https://faucet.testnet.aptoslabs.com").unwrap()); | ||
|
||
pub const FUND_AMOUNT: u64 = 100_000_000; | ||
|
||
// Persistency check constants | ||
|
||
// How long a persistent check runs for. | ||
pub static PERSISTENCY_TIMEOUT: Lazy<Duration> = Lazy::new(|| { | ||
env::var("PERSISTENCY_TIMEOUT") | ||
.ok() | ||
.and_then(|s| s.parse().ok()) | ||
.map(Duration::from_secs) | ||
.unwrap_or(Duration::from_secs(30)) | ||
}); | ||
|
||
// Wait time between tries during a persistent check. | ||
pub static SLEEP_PER_CYCLE: Lazy<Duration> = Lazy::new(|| { | ||
env::var("SLEEP_PER_CYCLE") | ||
.ok() | ||
.and_then(|s| s.parse().ok()) | ||
.map(Duration::from_millis) | ||
.unwrap_or(Duration::from_millis(100)) | ||
}); | ||
|
||
// Runtime constants | ||
|
||
// The number of threads to use for running tests. | ||
pub static NUM_THREADS: Lazy<usize> = Lazy::new(|| { | ||
env::var("NUM_THREADS") | ||
.ok() | ||
.and_then(|s| s.parse().ok()) | ||
.unwrap_or(4) | ||
}); | ||
|
||
// The size of the stack for each thread. | ||
pub static STACK_SIZE: Lazy<usize> = Lazy::new(|| { | ||
env::var("STACK_SIZE") | ||
.ok() | ||
.and_then(|s| s.parse().ok()) | ||
.unwrap_or(4 * 1024 * 1024) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright © Aptos Foundation | ||
|
||
#[macro_export] | ||
macro_rules! time_fn { | ||
($func:expr, $($arg:expr), *) => {{ | ||
// start timer | ||
let start = tokio::time::Instant::now(); | ||
|
||
// call the flow | ||
let result = $func($($arg),+).await; | ||
|
||
// end timer | ||
let time = (tokio::time::Instant::now() - start).as_micros() as f64; | ||
|
||
// return | ||
(result, time) | ||
}}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.