-
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
12 changed files
with
746 additions
and
296 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright © Aptos Foundation | ||
|
||
use once_cell::sync::Lazy; | ||
use std::{env, time::Duration}; | ||
use url::Url; | ||
|
||
// 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 | ||
|
||
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)) | ||
}); | ||
|
||
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 | ||
|
||
pub static NUM_THREADS: Lazy<usize> = Lazy::new(|| { | ||
env::var("NUM_THREADS") | ||
.ok() | ||
.and_then(|s| s.parse().ok()) | ||
.unwrap_or(4) | ||
}); | ||
|
||
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 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 |
---|---|---|
@@ -1,27 +1,27 @@ | ||
// Copyright © Aptos Foundation | ||
|
||
pub static FAIL_WRONG_ACCOUNT_DATA: &str = "wrong account data"; | ||
pub static FAIL_WRONG_BALANCE: &str = "wrong balance"; | ||
pub static FAIL_WRONG_BALANCE_AT_VERSION: &str = "wrong balance at version"; | ||
pub static FAIL_WRONG_COLLECTION_DATA: &str = "wrong collection data"; | ||
pub static FAIL_WRONG_MESSAGE: &str = "wrong message"; | ||
pub static FAIL_WRONG_MODULE: &str = "wrong module"; | ||
pub static FAIL_WRONG_TOKEN_BALANCE: &str = "wrong token balance"; | ||
pub static FAIL_WRONG_TOKEN_DATA: &str = "wrong token data"; | ||
pub static ERROR_COULD_NOT_BUILD_PACKAGE: &str = "failed to build package"; | ||
pub static ERROR_COULD_NOT_CHECK: &str = "persistency check never started"; | ||
pub static ERROR_COULD_NOT_CREATE_ACCOUNT: &str = "failed to create account"; | ||
pub static ERROR_COULD_NOT_CREATE_TRANSACTION: &str = "failed to create transaction"; | ||
pub static ERROR_COULD_NOT_FINISH_TRANSACTION: &str = "failed to finish transaction"; | ||
pub static ERROR_COULD_NOT_FUND_ACCOUNT: &str = "failed to fund account"; | ||
pub static ERROR_COULD_NOT_SERIALIZE: &str = "failed to serialize"; | ||
pub static ERROR_NO_ACCOUNT_DATA: &str = "can't find account data"; | ||
pub static ERROR_NO_BALANCE: &str = "can't find account balance"; | ||
pub static ERROR_NO_BYTECODE: &str = "can't find bytecode"; | ||
pub static ERROR_NO_COLLECTION_DATA: &str = "can't find collection data"; | ||
pub static ERROR_NO_MESSAGE: &str = "can't find message"; | ||
pub static ERROR_NO_METADATA: &str = "can't find metadata"; | ||
pub static ERROR_NO_MODULE: &str = "can't find module"; | ||
pub static ERROR_NO_TOKEN_BALANCE: &str = "can't find token balance"; | ||
pub static ERROR_NO_TOKEN_DATA: &str = "can't find token data"; | ||
pub static ERROR_NO_VERSION: &str = "can't find transaction version"; | ||
pub const FAIL_WRONG_ACCOUNT_DATA: &str = "wrong account data"; | ||
pub const FAIL_WRONG_BALANCE: &str = "wrong balance"; | ||
pub const FAIL_WRONG_BALANCE_AT_VERSION: &str = "wrong balance at version"; | ||
pub const FAIL_WRONG_COLLECTION_DATA: &str = "wrong collection data"; | ||
pub const FAIL_WRONG_MESSAGE: &str = "wrong message"; | ||
pub const FAIL_WRONG_MODULE: &str = "wrong module"; | ||
pub const FAIL_WRONG_TOKEN_BALANCE: &str = "wrong token balance"; | ||
pub const FAIL_WRONG_TOKEN_DATA: &str = "wrong token data"; | ||
pub const ERROR_COULD_NOT_BUILD_PACKAGE: &str = "failed to build package"; | ||
pub const ERROR_COULD_NOT_CHECK: &str = "persistency check never started"; | ||
pub const ERROR_COULD_NOT_CREATE_ACCOUNT: &str = "failed to create account"; | ||
pub const ERROR_COULD_NOT_CREATE_TRANSACTION: &str = "failed to create transaction"; | ||
pub const ERROR_COULD_NOT_FINISH_TRANSACTION: &str = "failed to finish transaction"; | ||
pub const ERROR_COULD_NOT_FUND_ACCOUNT: &str = "failed to fund account"; | ||
pub const ERROR_COULD_NOT_SERIALIZE: &str = "failed to serialize"; | ||
pub const ERROR_NO_ACCOUNT_DATA: &str = "can't find account data"; | ||
pub const ERROR_NO_BALANCE: &str = "can't find account balance"; | ||
pub const ERROR_NO_BYTECODE: &str = "can't find bytecode"; | ||
pub const ERROR_NO_COLLECTION_DATA: &str = "can't find collection data"; | ||
pub const ERROR_NO_MESSAGE: &str = "can't find message"; | ||
pub const ERROR_NO_METADATA: &str = "can't find metadata"; | ||
pub const ERROR_NO_MODULE: &str = "can't find module"; | ||
pub const ERROR_NO_TOKEN_BALANCE: &str = "can't find token balance"; | ||
pub const ERROR_NO_TOKEN_DATA: &str = "can't find token data"; | ||
pub const ERROR_NO_VERSION: &str = "can't find transaction version"; |
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.