diff --git a/backend/windmill-common/src/tracing_init.rs b/backend/windmill-common/src/tracing_init.rs index 0f31072ba5..fe8366f399 100644 --- a/backend/windmill-common/src/tracing_init.rs +++ b/backend/windmill-common/src/tracing_init.rs @@ -53,7 +53,13 @@ pub fn initialize_tracing() { match json_fmt { true => ts_base.with(json_layer().flatten_event(true)).init(), false => ts_base - .with(compact_layer().with_ansi(style.to_lowercase() != "never")) + .with( + compact_layer() + .with_ansi(style.to_lowercase() != "never") + .with_file(true) + .with_line_number(true) + .with_target(false), + ) .init(), } } diff --git a/backend/windmill-worker/src/python_executor.rs b/backend/windmill-worker/src/python_executor.rs index fbcae34469..b8e1be3d38 100644 --- a/backend/windmill-worker/src/python_executor.rs +++ b/backend/windmill-worker/src/python_executor.rs @@ -391,8 +391,6 @@ mount {{ } tracing::info!( - worker_name = %worker_name, - job_id = %job.id, workspace_id = %job.workspace_id, "started python code execution {}", job.id @@ -614,7 +612,7 @@ async fn replace_pip_secret( } let secret = get_secret_value_as_admin(db, w_id, variable).await?; tracing::info!( - worker_name = %worker_name, + worker = %worker_name, job_id = %job_id, workspace_id = %w_id, "found secret variable in pip requirements: {}", @@ -878,16 +876,12 @@ pub async fn handle_python_reqs( append_logs(job_id.clone(), w_id.to_string(), logs1, db).await; tracing::info!( - worker_name = %worker_name, - job_id = %job_id, workspace_id = %w_id, "started setup python dependencies" ); let child = if !*DISABLE_NSJAIL { tracing::info!( - worker_name = %worker_name, - job_id = %job_id, workspace_id = %w_id, "starting nsjail" ); @@ -992,8 +986,6 @@ pub async fn handle_python_reqs( ) .await; tracing::info!( - worker_name = %worker_name, - job_id = %job_id, workspace_id = %w_id, is_ok = child.is_ok(), "finished setting up python dependencies {}", diff --git a/backend/windmill-worker/src/worker.rs b/backend/windmill-worker/src/worker.rs index d9d7282613..c634988feb 100644 --- a/backend/windmill-worker/src/worker.rs +++ b/backend/windmill-worker/src/worker.rs @@ -13,6 +13,7 @@ use prometheus::{ core::{AtomicI64, GenericGauge}, IntCounter, }; +use tracing::Instrument; #[cfg(feature = "prometheus")] use windmill_common::METRICS_DEBUG_ENABLED; #[cfg(feature = "prometheus")] @@ -584,6 +585,7 @@ impl JobCompletedSender { } } +#[tracing::instrument(name = "worker", level = "info", skip_all, fields(worker = %worker_name))] pub async fn run_worker( db: &Pool, worker_instance: &str, @@ -608,7 +610,7 @@ pub async fn run_worker { @@ -1200,7 +1202,7 @@ pub async fn run_worker = None; let mut last_checked_suspended = Instant::now(); @@ -1214,7 +1216,7 @@ pub async fn run_worker>>, @@ -1385,17 +1387,17 @@ pub async fn run_worker secs { - tracing::info!(worker = %worker_name, "no job for {} seconds, exiting", secs); + tracing::info!("no job for {} seconds, exiting", secs); break; } } else { @@ -1768,7 +1772,7 @@ pub async fn run_worker { - tracing::error!(worker = %worker_name, "Failed to pull jobs: {}", err); + tracing::error!("Failed to pull jobs: {}", err); } }; } @@ -1797,7 +1801,6 @@ pub async fn run_worker>, Option>); @@ -2218,6 +2221,7 @@ async fn queue_init_bash_maybe<'c, R: rsmq_async::RsmqConnection + Send + 'c>( // logs: String, // ) -> error::Result<()> { +#[tracing::instrument(name = "completed_job", level = "info", skip_all, fields(job_id = %job.id))] pub async fn process_completed_job( JobCompleted { job, result, mem_peak, success, cached_res_path, canceled_by, .. }: JobCompleted, client: &AuthedClient, @@ -2359,6 +2363,8 @@ pub async fn process_completed_job( db: &Pool, client: &AuthedClient, @@ -2554,7 +2560,7 @@ pub struct PreviousResult<'a> { pub previous_result: Option<&'a RawValue>, } -#[tracing::instrument(level = "trace", skip_all)] +#[tracing::instrument(name = "job", level = "info", skip_all, fields(job_id = %job.id))] async fn handle_queued_job( job: Arc, db: &DB, @@ -2731,8 +2737,6 @@ async fn handle_queued_job( } tracing::debug!( - worker = %worker_name, - job_id = %job.id, workspace_id = %job.workspace_id, "handling job {}", job.id @@ -3210,8 +3214,6 @@ async fn handle_code_execution_job( .unwrap_or_else(|| "NO_LANG".to_string()); tracing::debug!( - worker_name = %worker_name, - job_id = %job.id, workspace_id = %job.workspace_id, "started {} job {}", &lang_str, @@ -3346,8 +3348,6 @@ mount {{ _ => panic!("unreachable, language is not supported: {language:#?}"), }; tracing::info!( - worker_name = %worker_name, - job_id = %job.id, workspace_id = %job.workspace_id, is_ok = result.is_ok(), "finished {} job {}", diff --git a/backend/windmill-worker/src/worker_flow.rs b/backend/windmill-worker/src/worker_flow.rs index f6728e9742..4a939e4da2 100644 --- a/backend/windmill-worker/src/worker_flow.rs +++ b/backend/windmill-worker/src/worker_flow.rs @@ -671,7 +671,7 @@ pub async fn update_flow_status_after_job_completion_internal< .root_job .map(|x| x.to_string()) .unwrap_or_else(|| "none".to_string()); - tracing::info!(id = %flow_job.id, root_id = %job_root, worker_name = %worker_name, "update flow status"); + tracing::info!(id = %flow_job.id, root_id = %job_root, "update flow status"); let module = get_module(&flow_job, module_index); @@ -869,7 +869,7 @@ pub async fn update_flow_status_after_job_completion_internal< } if let Some(parent_job) = flow_job.parent_job { - tracing::info!(subflow_id = %flow_job.id, parent_id = %parent_job, worker_name = %worker_name, "subflow is finished, updating parent flow status"); + tracing::info!(subflow_id = %flow_job.id, parent_id = %parent_job, "subflow is finished, updating parent flow status"); return Ok(Some(RecUpdateFlowStatusAfterJobCompletion { flow: parent_job,