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 f3fbaca
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions docs/tracing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# 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 result in a signficant increase in the binary size and a signficant regression in performance.

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"
```

This can mitigate most of the performance regression.

0 comments on commit f3fbaca

Please sign in to comment.