nekotracing
What it is and What it Does
nekotracing is a Rust 🦀 crate that provides a minimalist solution for instrumenting synchronous functions and async fn using a single attribute macro: #[nekotrancing].
Its primary goal is to generate execution traces that record the flow and timing of specific instrumented functions.
📝 Trace Destination: tracing/
The central feature of nekotracing is that it appends these traces, formatted for easy human and machine parsing, to a file named tracing/, which is created in the root directory of your project.
🔍 Captured Information
For every marked function, the trace records the following data, as seen in the example:
- Timestamp: The exact moment the function was executed.
- Location: The file and line number of the code.
- Function Name: (e.g.,
fn sync_user). - Arguments: The serialized values of the input parameters.
- Return Value: The value or result returned by the function.
- Execution Time: The total duration of the function call (e.g.,
execution time=92.045µs).
🚀 Use Cases
nekotracing is ideal for:
- Quick Profiling: Measuring the performance of critical code sections, especially within unit tests.
- Lightweight Diagnostics: Monitoring runtime behavior for debugging or CI (Continuous Integration) checks, without the overhead of a more complex tracing system.
use Builder;
use nekotracing;
async
Example Output (tracing/2025-10-17T01-25-28.832894520-03-00@tests__user.rs-12-5.txt)
fn sync_user␞(self = User { id: 0, name: "", age: 0 }) -> "Ok(User { id: 0, name: \"sync user\", age: 18 })"␞execution time=73.951µs