Merged
Conversation
489acde to
7ff7b03
Compare
7ff7b03 to
58caf0d
Compare
ludfjig
previously approved these changes
Jan 23, 2026
Contributor
|
@dblnz would you like to get this into the next release (we have it scheduled for next week (Feb 25th) |
58caf0d to
3f6bb07
Compare
Contributor
Author
Yes, I'm rebasing it to include it in the release |
6e47f8f to
72aaf11
Compare
jsturtevant
previously approved these changes
Feb 20, 2026
ludfjig
previously approved these changes
Feb 20, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes issue #990 by implementing proper filtering of guest tracing spans and events based on the max_log_level parameter. Previously, even though the log level was correctly received by guests, only logs were filtered while tracing spans and events were not.
Changes:
- Introduced a new
GuestLogFilterenum to unify log level conversions betweenlog::LevelFilter,tracing_core::LevelFilter, and u64 values passed across the host-guest boundary - Implemented filtering in the
GuestSubscriber::enabled()method to properly filter tracing spans and events based on the maximum log level - Updated trace span levels from
TracetoInfofor infrastructure calls (halt, dispatch_function, call_guest_function, call_host_function) to ensure they are visible at appropriate log levels and updated test expectations accordingly
Reviewed changes
Copilot reviewed 18 out of 22 changed files in this pull request and generated 2 comments.
Show a summary per file
| 8000 File | Description |
|---|---|
| src/hyperlight_common/src/log_level.rs | New file introducing GuestLogFilter enum with conversions to/from log::LevelFilter, tracing_core::LevelFilter, and u64 |
| src/hyperlight_common/src/lib.rs | Adds log_level module export |
| src/hyperlight_common/Cargo.toml | Adds tracing-core dependency |
| src/hyperlight_guest_tracing/src/subscriber.rs | Adds max_log_level field and implements filtering in enabled() method |
| src/hyperlight_guest_tracing/src/lib.rs | Updates init_guest_tracing to accept LevelFilter parameter |
| src/hyperlight_guest_tracing/Cargo.toml | Adds "log" feature to tracing dependency for log/tracing interop |
| src/hyperlight_guest_bin/src/lib.rs | Updates to use GuestLogFilter for initialization |
| src/hyperlight_guest_bin/src/guest_logger.rs | Minor parameter rename for clarity |
| src/hyperlight_guest_bin/src/guest_function/call.rs | Updates trace levels from Trace to Info and removes explicit parent span references |
| src/hyperlight_host/src/hypervisor/mod.rs | Removes old get_max_log_level function |
| src/hyperlight_host/src/hypervisor/hyperlight_vm.rs | Adds new get_max_log_level_filter and get_guest_log_filter functions with proper conversions |
| src/hyperlight_host/src/sandbox/uninitialized.rs | Updates imports to use tracing_core::LevelFilter |
| src/hyperlight_host/src/sandbox/trace/context.rs | Updates span levels from trace to info |
| src/hyperlight_host/tests/integration_test.rs | Updates test expectations to account for new info-level trace logs and converts to use tracing_core::LevelFilter |
| src/hyperlight_guest/src/exit.rs | Updates halt span level from Trace to Info |
| src/hyperlight_guest/src/guest_handle/io.rs | Removes explicit parent span reference |
| src/hyperlight_guest/src/guest_handle/host_comm.rs | Adds instrumentation and updates trace levels |
| src/tests/rust_guests/simpleguest/src/main.rs | CRITICAL BUG: Incorrect conversion logic in LogMessage function |
| Cargo.lock files | Updates dependency locks for tracing-core additions |
72aaf11 to
214c2de
Compare
214c2de to
f4c4af9
Compare
jsturtevant
previously approved these changes
Feb 23, 2026
f4c4af9 to
b243e36
Compare
…arent - To make the codebase more readable, remove the `parent` argument from the `#[instrument]` attribute. Signed-off-by: Doru Blânzeanu <dblnz@pm.me>
- The `max_log_level` argument provided to the guest function is now used to filter traces also Signed-off-by: Doru Blânzeanu <dblnz@pm.me>
… and logging - Adds a `GuestLogFilter` enum that is used as an intermediary type between the `u64` used as a register to call the guest entrypoint and the `log::LogFilter` or `tracing_core::LogFilter`. - Adds unit tests for the `GuestLogFilter`. Signed-off-by: Doru Blânzeanu <dblnz@pm.me>
b243e36 to
e7fe98b
Compare
- Add more comments and tests to verify the new logic works as expected Signed-off-by: Doru Blânzeanu <dblnz@pm.me>
e7fe98b to
57170e2
Compare
ludfjig
approved these changes
Mar 4, 2026
danbugs
pushed a commit
to nanvix/hyperlight
that referenced
this pull request
Mar 5, 2026
* [trace-guest] Update guest library trace levels and remove explicit parent - To make the codebase more readable, remove the `parent` argument from the `#[instrument]` attribute. Signed-off-by: Doru Blânzeanu <dblnz@pm.me> * [trace-guest] Add trace filtering based on max_log_level - The `max_log_level` argument provided to the guest function is now used to filter traces also Signed-off-by: Doru Blânzeanu <dblnz@pm.me> * [trace-guest] Define a common log level filter to be used for tracing and logging - Adds a `GuestLogFilter` enum that is used as an intermediary type between the `u64` used as a register to call the guest entrypoint and the `log::LogFilter` or `tracing_core::LogFilter`. - Adds unit tests for the `GuestLogFilter`. Signed-off-by: Doru Blânzeanu <dblnz@pm.me> * [host] Simplify `get_max_log_level_filter` function - Add more comments and tests to verify the new logic works as expected Signed-off-by: Doru Blânzeanu <dblnz@pm.me> --------- Signed-off-by: Doru Blânzeanu <dblnz@pm.me> Signed-off-by: danbugs <danilochiarlone@gmail.com>
danbugs
pushed a commit
to nanvix/hyperlight
that referenced
this pull request
Mar 5, 2026
* [trace-guest] Update guest library trace levels and remove explicit parent - To make the codebase more readable, remove the `parent` argument from the `#[instrument]` attribute. Signed-off-by: Doru Blânzeanu <dblnz@pm.me> * [trace-guest] Add trace filtering based on max_log_level - The `max_log_level` argument provided to the guest function is now used to filter traces also Signed-off-by: Doru Blânzeanu <dblnz@pm.me> * [trace-guest] Define a common log level filter to be used for tracing and logging - Adds a `GuestLogFilter` enum that is used as an intermediary type between the `u64` used as a register to call the guest entrypoint and the `log::LogFilter` or `tracing_core::LogFilter`. - Adds unit tests for the `GuestLogFilter`. Signed-off-by: Doru Blânzeanu <dblnz@pm.me> * [host] Simplify `get_max_log_level_filter` function - Add more comments and tests to verify the new logic works as expected Signed-off-by: Doru Blânzeanu <dblnz@pm.me> --------- Signed-off-by: Doru Blânzeanu <dblnz@pm.me> Signed-off-by: danbugs <danilochiarlone@gmail.com>
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.
This closes #990.
Currently, when tracing guests, the max log level parameter provided to the guest is not used to filter out traces.
This PR adds the filtering capability for the guest tracing and also modifies some of the trace levels in the guest.
For that to work, a change in the
integration_tests.rswas necessary to update the number of expected logs inlog_messagetest