Skip to content

Conversation

@claude
Copy link
Contributor

@claude claude bot commented Jan 2, 2026

Summary

  • Adds QUIET_MODE environment variable (set to "true" or "1" to enable) that filters noise logs
  • Marks worker per-job logs with windmill_verbose target that gets filtered in quiet mode
  • Increases periodic log intervals by 10x when quiet mode is enabled

Changes

backend/windmill-common/src/tracing_init.rs

  • Added QUIET_MODE lazy_static env var
  • Added VERBOSE_TARGET constant ("windmill_verbose") for logs that should be suppressed
  • Created create_targets_filter() helper that filters the verbose target when quiet mode is on

backend/windmill-worker/src/handle_child.rs

  • Changed periodic logs to use VERBOSE_TARGET:
    • "job still running" log
    • "worker memory snapshot" log
    • "job finished" log
    • "child process took" log
  • Increased "still running" log interval from every tick (500ms) to every 10 ticks (5s) in quiet mode
  • Increased memory snapshot log interval from every 10 ticks (5s) to every 100 ticks (50s) in quiet mode

backend/windmill-worker/src/worker.rs

  • Changed per-job logs to use VERBOSE_TARGET:
    • "started handling of job" log
    • "fetched job" log
  • Added quiet mode notification in job logs

Test plan

  • Run worker with QUIET_MODE=true and verify verbose logs are suppressed
  • Run worker without QUIET_MODE and verify all logs appear normally
  • Verify periodic logs have increased intervals in quiet mode

Closes #7477

🤖 Generated with Claude Code

Add QUIET_MODE environment variable (set to "true" or "1" to enable) that:
- Filters logs with the "windmill_verbose" target via tracing_init
- Increases frequency of periodic logs by 10x when enabled
- Marks per-job worker logs as verbose so they are suppressed in quiet mode

Key changes:
- Add QUIET_MODE lazy_static and VERBOSE_TARGET constant to tracing_init.rs
- Create create_targets_filter() helper that filters windmill_verbose target
- Mark periodic "still running" and "memory snapshot" logs with VERBOSE_TARGET
- Mark per-job "fetched job", "started handling", "job finished" logs as verbose
- Increase memory snapshot interval from every 10 ticks to every 100 ticks in quiet mode
- Increase "still running" log interval from every tick to every 10 ticks in quiet mode
- Add quiet mode notification in job logs

Closes #7477

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: windmill-internal-app[bot] <windmill-internal-app[bot]@users.noreply.github.com>
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 2, 2026

Deploying windmill with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1c1c877
Status: ✅  Deploy successful!
Preview URL: https://a2a75fb8.windmill.pages.dev
Branch Preview URL: https://claude-issue-7477-20260102-0.windmill.pages.dev

View logs

@rubenfiszel rubenfiszel marked this pull request as ready for review January 6, 2026 18:28
@claude
Copy link
Contributor Author

claude bot commented Jan 6, 2026

Claude finished @claude[bot]'s task in 1m 51s —— View job


Code Review: Quiet Mode Implementation

Tasks

  • Read and analyze the changed files
  • Review code quality and best practices
  • Check for potential bugs or issues
  • Evaluate performance considerations
  • Assess security implications
  • Provide comprehensive feedback with inline comments

Summary

This PR implements a quiet mode feature that filters verbose worker logs when enabled via the QUIET environment variable. The implementation is well-structured and follows existing patterns in the codebase.

General Observations

Strengths:

  • Clean refactoring: The create_targets_filter() helper function properly encapsulates the filter logic and removes code duplication
  • Good use of the existing tracing infrastructure with the target: parameter
  • Appropriate use of lazy_static! for the environment variable check
  • The frequency reduction for periodic logs (10x less frequent in quiet mode) is a sensible approach

Issues Found:

  1. Naming Consistency - See inline comment on tracing_init.rs:41
  2. Comment-Code Mismatch - See inline comment on handle_child.rs:704
  3. Interval Behavior Clarification - See inline comment on handle_child.rs:728

Security & Performance

  • ✅ No security concerns - this only affects logging verbosity
  • ✅ Performance impact is positive - reduces log I/O in quiet mode
  • ✅ Environment variable reading uses lazy_static! so it's evaluated once at startup

Testing Instructions

To verify these changes through the application:

Deploy a Windmill worker with the QUIET=true environment variable set. Run a script or flow that takes several seconds to complete and observe the worker logs. In quiet mode, you should see significantly fewer "job still running", "memory snapshot", and "fetched job" log entries compared to running without QUIET=true. Additionally, check that the job execution log includes the line "Quiet mode enabled: verbose service logs are suppressed" confirming the mode is active.

Err(Error::NotFound("not yet initialized".to_string()));

loop {
tokio::select!(
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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 update_job_row logic on line 733 and is unchanged.

Suggested change
tokio::select!(
// update the last_ping column every 5 seconds (or 50 seconds in quiet mode)

Consider updating to:

Suggested change
tokio::select!(
// Log memory snapshot and ping status (in quiet mode, logs emit 10x less frequently)


lazy_static::lazy_static! {
pub static ref JSON_FMT: bool = std::env::var("JSON_FMT").map(|x| x == "true").unwrap_or(false);
pub static ref QUIET_MODE: bool = std::env::var("QUIET").map(|x| x == "true" || x == "1").unwrap_or(false);
Copy link
Contributor Author

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_LOGS environment variable defined in windmill-common/src/lib.rs:171 that also controls log verbosity. Having both QUIET and QUIET_LOGS could confuse users.

Consider either:

  1. Reusing QUIET_LOGS for this feature
  2. Documenting the difference clearly (e.g., QUIET_LOGS for conditional code checks vs QUIET for tracing filter)
  3. Consolidating both into a single env var

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 {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: With still_running_interval = 10, the condition i % 10 == 0 means the first "still running" log will appear at tick 10 (5 seconds) in quiet mode, whereas normally it appears at every tick.

At tick 1: 1 % 10 = 1 ≠ 0 → no log
At tick 10: 10 % 10 = 0 → log

This is likely the intended behavior, just confirming it's not accidental that the first few ticks are skipped.

@rubenfiszel rubenfiszel merged commit 62bb11e into main Jan 6, 2026
8 checks passed
@rubenfiszel rubenfiszel deleted the claude/issue-7477-20260102-0846 branch January 6, 2026 18:39
@github-actions github-actions bot locked and limited conversation to collaborators Jan 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

implement quiet mode to filter noise logs

2 participants