-
Notifications
You must be signed in to change notification settings - Fork 862
feat: implement quiet mode to filter verbose logs #7478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -58,6 +58,8 @@ use crate::job_logger_oss::process_streaming_log_lines; | |||||||||
| use crate::worker_utils::{ping_job_status, update_worker_ping_from_job}; | ||||||||||
| use crate::{MAX_RESULT_SIZE, MAX_WAIT_FOR_SIGINT, MAX_WAIT_FOR_SIGTERM}; | ||||||||||
|
|
||||||||||
| use windmill_common::tracing_init::{QUIET_MODE, VERBOSE_TARGET}; | ||||||||||
|
|
||||||||||
| lazy_static::lazy_static! { | ||||||||||
| pub static ref SLOW_LOGS: bool = std::env::var("SLOW_LOGS").ok().is_some_and(|x| x == "1" || x == "true"); | ||||||||||
| pub static ref OTEL_JOB_LOGS: bool = std::env::var("OTEL_JOB_LOGS").ok().is_some_and(|x| x == "1" || x == "true"); | ||||||||||
|
|
@@ -702,9 +704,11 @@ where | |||||||||
| tokio::select!( | ||||||||||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The comment mentions "update the last_ping column every 5 seconds (or 50 seconds in quiet mode)" but the quiet mode change only affects log frequency, not the ping interval. The ping frequency is still controlled by the
Suggested change
Consider updating to:
Suggested change
|
||||||||||
| _ = rx.recv() => break, | ||||||||||
| _ = interval.tick() => { | ||||||||||
| // update the last_ping column every 5 seconds | ||||||||||
| // update the last_ping column every 5 seconds (or 50 seconds in quiet mode) | ||||||||||
| i+=1; | ||||||||||
| if i == 1 || i % 10 == 0 { | ||||||||||
| // In quiet mode, emit memory snapshot logs 10x less frequently | ||||||||||
| let memory_snapshot_interval = if *QUIET_MODE { 100 } else { 10 }; | ||||||||||
| if i == 1 || i % memory_snapshot_interval == 0 { | ||||||||||
| let memory_usage = get_worker_memory_usage(); | ||||||||||
| let wm_memory_usage = get_windmill_memory_usage(); | ||||||||||
| tracing::info!("job {job_id} on {worker_name} in {w_id} worker memory snapshot {}kB/{}kB", memory_usage.unwrap_or_default()/1024, wm_memory_usage.unwrap_or_default()/1024); | ||||||||||
|
|
@@ -719,7 +723,11 @@ where | |||||||||
| if current_mem > *mem_peak { | ||||||||||
| *mem_peak = current_mem | ||||||||||
| } | ||||||||||
| tracing::info!("job {job_id} on {worker_name} in {w_id} still running. mem: {current_mem}kB, peak mem: {mem_peak}kB"); | ||||||||||
| // In quiet mode, emit "still running" logs 10x less frequently | ||||||||||
| let still_running_interval = if *QUIET_MODE { 10 } else { 1 }; | ||||||||||
| if i % still_running_interval == 0 { | ||||||||||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: With At tick 1: This is likely the intended behavior, just confirming it's not accidental that the first few ticks are skipped. |
||||||||||
| tracing::info!("job {job_id} on {worker_name} in {w_id} still running. mem: {current_mem}kB, peak mem: {mem_peak}kB"); | ||||||||||
| } | ||||||||||
|
|
||||||||||
|
|
||||||||||
| let update_job_row = i == 2 || (!*SLOW_LOGS && (i < 20 || (i < 120 && i % 5 == 0) || i % 10 == 0)) || i % 20 == 0; | ||||||||||
|
|
@@ -778,7 +786,7 @@ where | |||||||||
| }, | ||||||||||
| ); | ||||||||||
| } | ||||||||||
| tracing::info!("job {job_id} finished"); | ||||||||||
| tracing::info!(target: VERBOSE_TARGET, "job {job_id} finished"); | ||||||||||
|
|
||||||||||
| UpdateJobPollingExit::Done(canceled_by_ref.clone()) | ||||||||||
| } | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's an existing
QUIET_LOGSenvironment variable defined inwindmill-common/src/lib.rs:171that also controls log verbosity. Having bothQUIETandQUIET_LOGScould confuse users.Consider either:
QUIET_LOGSfor this featureQUIET_LOGSfor conditional code checks vsQUIETfor tracing filter)