Tracing PoC
Try out to see how tracing can be used instead of the current Logger. Advantages:
- No more logger to pass around
- No more L: Deref, L::Target:Logger generics
- Using spans to get more insights in execution flow, using standard tools
- Adding data fields to spans without requiring a specific With...Logger instance
To keep apart test logs in multi-node tests, a proc macro is used to automatically enter a node specific span at the beginning of each public function.
Tracing dependencies:
├── tracing v0.1.41
│ ├── pin-project-lite v0.2.16
│ ├── tracing-attributes v0.1.30 (proc-macro)
│ │ ├── proc-macro2 v1.0.103 (*)
│ │ ├── quote v1.0.41 (*)
│ │ └── syn v2.0.106 (*)
│ └── tracing-core v0.1.34
│ └── once_cell v1.21.3
Logger cleanup preview: https://github.com/lightningdevkit/rust-lightning/compare/main...joostjager:logger-cleanup
👋 Hi! I see this is a draft PR. I'll wait to assign reviewers until you mark it as ready for review. Just convert it out of draft status when you're ready for review!
Tracing dependencies:
├── tracing v0.1.41 │ ├── pin-project-lite v0.2.16 │ ├── tracing-attributes v0.1.30 (proc-macro) │ │ ├── proc-macro2 v1.0.103 (*) │ │ ├── quote v1.0.41 (*) │ │ └── syn v2.0.106 (*) │ └── tracing-core v0.1.34 │ └── once_cell v1.21.3
Not necessarily a blocker, but may be noteworthy that pin-project-lite seems to be a more or less single-contributor project, with close to 500k dependent repositories and more than 1k dependent crates: https://github.com/taiki-e/pin-project-lite/network/dependents
I've been exploring what spans could do for us if we'd be using tracing. There are many ways to visualize these traces. I tried a few and it seems that https://github.com/davidbarsky/tracing-tree can be useful.
It produces output like this: