mirror of
https://github.com/logos-blockchain/logos-blockchain-testing.git
synced 2026-01-02 13:23:13 +00:00
Add workload logging
This commit is contained in:
parent
f31aa99c0e
commit
75541abaa2
@ -7,6 +7,7 @@ use tokio::time::{Instant, sleep};
|
||||
use tracing::info;
|
||||
|
||||
/// Randomly restarts validators and executors during a run to introduce chaos.
|
||||
#[derive(Debug)]
|
||||
pub struct RandomRestartWorkload {
|
||||
min_delay: Duration,
|
||||
max_delay: Duration,
|
||||
@ -137,6 +138,14 @@ impl Workload for RandomRestartWorkload {
|
||||
return Err("chaos restart workload has no eligible targets".into());
|
||||
}
|
||||
|
||||
tracing::info!(
|
||||
config = ?self,
|
||||
validators = ctx.descriptors().validators().len(),
|
||||
executors = ctx.descriptors().executors().len(),
|
||||
target_count = targets.len(),
|
||||
"starting chaos restart workload"
|
||||
);
|
||||
|
||||
let mut cooldowns = self.initialize_cooldowns(&targets);
|
||||
|
||||
loop {
|
||||
@ -144,14 +153,20 @@ impl Workload for RandomRestartWorkload {
|
||||
let target = self.pick_target(&targets, &cooldowns).await;
|
||||
|
||||
match target {
|
||||
Target::Validator(index) => handle
|
||||
.restart_validator(index)
|
||||
.await
|
||||
.map_err(|err| format!("validator restart failed: {err}"))?,
|
||||
Target::Executor(index) => handle
|
||||
.restart_executor(index)
|
||||
.await
|
||||
.map_err(|err| format!("executor restart failed: {err}"))?,
|
||||
Target::Validator(index) => {
|
||||
tracing::info!(index, "chaos restarting validator");
|
||||
handle
|
||||
.restart_validator(index)
|
||||
.await
|
||||
.map_err(|err| format!("validator restart failed: {err}"))?
|
||||
}
|
||||
Target::Executor(index) => {
|
||||
tracing::info!(index, "chaos restarting executor");
|
||||
handle
|
||||
.restart_executor(index)
|
||||
.await
|
||||
.map_err(|err| format!("executor restart failed: {err}"))?
|
||||
}
|
||||
}
|
||||
|
||||
cooldowns.insert(target, Instant::now() + self.target_cooldown);
|
||||
|
||||
@ -3,11 +3,12 @@ use std::sync::Arc;
|
||||
use nomos_core::{
|
||||
block::Block,
|
||||
mantle::{
|
||||
AuthenticatedMantleTx as _, SignedMantleTx,
|
||||
AuthenticatedMantleTx as _, SignedMantleTx, Transaction as MantleTx,
|
||||
ops::{Op, channel::MsgId},
|
||||
},
|
||||
};
|
||||
use testing_framework_core::scenario::{DynError, RunContext};
|
||||
use tracing::debug;
|
||||
|
||||
/// Scans a block and invokes the matcher for every operation until it returns
|
||||
/// `Some(...)`. Returns `None` when no matching operation is found.
|
||||
@ -32,14 +33,22 @@ pub async fn submit_transaction_via_cluster(
|
||||
ctx: &RunContext,
|
||||
tx: Arc<SignedMantleTx>,
|
||||
) -> Result<(), DynError> {
|
||||
let tx_hash = tx.hash();
|
||||
debug!(?tx_hash, "submitting transaction via cluster");
|
||||
ctx.cluster_client()
|
||||
.try_all_clients(|client| {
|
||||
let tx = Arc::clone(&tx);
|
||||
Box::pin(async move {
|
||||
client
|
||||
let url = client.base_url().clone();
|
||||
debug!(?tx_hash, %url, "submitting transaction to client");
|
||||
let res = client
|
||||
.submit_transaction(&tx)
|
||||
.await
|
||||
.map_err(|err| -> DynError { err.into() })
|
||||
.map_err(|err| -> DynError { err.into() });
|
||||
if res.is_err() {
|
||||
debug!(?tx_hash, %url, "transaction submission failed");
|
||||
}
|
||||
res
|
||||
})
|
||||
})
|
||||
.await
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user