Skip to content

Commit

Permalink
docs: Tracing doc
Browse files Browse the repository at this point in the history
Add `tracing.md` to document how to use the instrumentation to trace the
Firecracker process.

Signed-off-by: Jonathan Woollett-Light <[email protected]>
  • Loading branch information
Jonathan Woollett-Light committed Oct 9, 2023
1 parent 4e2bd96 commit 451bbe2
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions docs/tracing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Tracing

Instrumentation based tracing is implemented with [`log`](https://github.com/rust-lang/log) and [`log_instrument`](https://github.com/JonathanWoollett-Light/log-instrument), outputing a `Trace` level log entering and exiting every function.

It is disabled by default at compile-time to remove any impact it would have on the release builds.

To enable it you need to remove `"max_level_debug"` from the features for `log` under [`src/vmm/Cargo.toml`](src/vmm/Cargo.toml):
```diff
- log = { version = "0.4.17", features = ["std", "serde", "max_level_debug"] }
+ log = { version = "0.4.17", features = ["std", "serde"] }
```

This will enable tracing every function in Firecracker which will results in a signficant increase in the binary size and a signficant regression in performance.

To mitigate this you can filter by module and file, this can be done like:

```bash
curl -X PUT --unix-socket "${API_SOCKET}" \
--data "{
\"log_path\": \"${LOGFILE}\",
# Instrumentation logs are `Trace` level, at runtime the level must be set to `Trace` to see them.
\"level\": \"Trace\",
\"show_level\": true,
\"show_log_origin\": true,
# Only outputs logs from `src/firecracker/src/api_server_adapter.rs`.
\"file\": \"src/firecracker/src/api_server_adapter.rs\",
}" \
"http://localhost/logger"
```

0 comments on commit 451bbe2

Please sign in to comment.