openvmm_entry: disable span output in tracing by default#3585
Merged
Conversation
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.
smalis-msft
reviewed
May 28, 2026
| BoxMakeWriter::new(std::io::stderr) | ||
| }; | ||
|
|
||
| let span_events = if std::env::var("OPENVMM_LOG_SPANS").is_ok_and(|v| !v.is_empty()) { |
Contributor
There was a problem hiding this comment.
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_eventsconfiguration for the fmt tracing layer. - Default span event output to
FmtSpan::NONEto 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 | ||
| }; |
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.
smalis-msft
approved these changes
May 28, 2026
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.