From 75541abaa21e6f1e6c38024077f417dd1bbbacbe Mon Sep 17 00:00:00 2001 From: andrussal Date: Thu, 11 Dec 2025 08:03:49 +0100 Subject: [PATCH] Add workload logging --- .../workflows/src/workloads/chaos.rs | 31 ++++++++++++++----- .../workflows/src/workloads/util.rs | 15 +++++++-- 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/testing-framework/workflows/src/workloads/chaos.rs b/testing-framework/workflows/src/workloads/chaos.rs index 57073d2..3ed58d1 100644 --- a/testing-framework/workflows/src/workloads/chaos.rs +++ b/testing-framework/workflows/src/workloads/chaos.rs @@ -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); diff --git a/testing-framework/workflows/src/workloads/util.rs b/testing-framework/workflows/src/workloads/util.rs index 0a94965..c65fa52 100644 --- a/testing-framework/workflows/src/workloads/util.rs +++ b/testing-framework/workflows/src/workloads/util.rs @@ -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, ) -> 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