Skip to content

openvmm_entry: disable span output in tracing by default#3585

Merged
jstarks merged 3 commits into
microsoft:mainfrom
jstarks:quiet
May 28, 2026
Merged

openvmm_entry: disable span output in tracing by default#3585
jstarks merged 3 commits into
microsoft:mainfrom
jstarks:quiet

Conversation

@jstarks
Copy link
Copy Markdown
Member

@jstarks jstarks commented May 28, 2026

Span NEW/CLOSE events are noisy and clutter stderr output during normal use. Disable them by default and gate them behind the OPENVMM_LOG_SPANS environment variable for when they're actually needed for debugging.

Span NEW/CLOSE events are noisy and clutter stderr output during
normal use. Disable them by default and gate them behind the
OPENVMM_LOG_SPANS environment variable for when they're actually
needed for debugging.
Copilot AI review requested due to automatic review settings May 28, 2026 17:52
@jstarks jstarks requested a review from a team as a code owner May 28, 2026 17:52
@jstarks jstarks marked this pull request as draft May 28, 2026 17:53
BoxMakeWriter::new(std::io::stderr)
};

let span_events = if std::env::var("OPENVMM_LOG_SPANS").is_ok_and(|v| !v.is_empty()) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

not empty or "0"

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR reduces default stderr noise from tracing_subscriber by disabling span NEW/CLOSE events by default in openvmm_entry, and re-enables them only when the OPENVMM_LOG_SPANS environment variable is set.

Changes:

  • Add an env-var-gated span_events configuration for the fmt tracing layer.
  • Default span event output to FmtSpan::NONE to avoid clutter during normal runs.

Comment on lines +57 to +61
let span_events = if std::env::var("OPENVMM_LOG_SPANS").is_ok_and(|v| !v.is_empty()) {
FmtSpan::NEW | FmtSpan::CLOSE
} else {
FmtSpan::NONE
};
Comment thread openvmm/openvmm_entry/src/tracing_init.rs Outdated
Comment thread openvmm/openvmm_entry/src/tracing_init.rs Outdated
These environment variables were previously undocumented. Add them to
the logging reference page so users know how to enable verbose span
output and disable rate limiting when debugging.
@github-actions
Copy link
Copy Markdown

@github-actions github-actions Bot added the Guide label May 28, 2026
@jstarks jstarks marked this pull request as ready for review May 28, 2026 22:25
Copilot AI review requested due to automatic review settings May 28, 2026 22:25
@jstarks jstarks merged commit 806b160 into microsoft:main May 28, 2026
98 checks passed
@jstarks jstarks deleted the quiet branch May 28, 2026 22:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

Comment on lines +61 to +65
let span_events = if env_bool(std::env::var("OPENVMM_LOG_SPANS")) {
FmtSpan::NEW | FmtSpan::CLOSE
} else {
FmtSpan::NONE
};
and info events from everything else

This is backed by the
[`EnvFilter`](https://docs.rs/tracing-subscriber/0.2.17/tracing_subscriber/struct.EnvFilter.html)
Comment on lines +18 to +19
By default, OpenVMM does not log span enter/exit events. To enable them, set
`OPENVMM_LOG_SPANS=1`.
Comment on lines +5 to +10
To configure logging, set the `OPENVMM_LOG` environment variable. The default
level is `info`. For example:

Enables debug events from all modules:

```cmd
set OPENVMM_LOG=debug
```

Enables trace events from the `mesh` crate and info events from everything else:

```cmd
set OPENVMM_LOG=info,mesh=trace
```
- `OPENVMM_LOG=debug` — enable debug events from all modules
- `OPENVMM_LOG=info,mesh=trace` — enable trace events from the `mesh` crate
and info events from everything else
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants