-
Notifications
You must be signed in to change notification settings - Fork 421
Tracing PoC #4211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Tracing PoC #4211
Conversation
|
👋 Hi! I see this is a draft PR. |
| // tracing_subscriber::fmt() | ||
| // // .with_span_list(true) // <--- print parent span chain | ||
| // .with_span_events(FmtSpan::FULL) | ||
| // .init(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default trace output, useful to see what's all that we have.
| } | ||
|
|
||
| fn do_test_keysend_payments(public_node: bool) { | ||
| let layer = TestTracerLayer {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Configure layer that produces TestLogger like output with a node id.
| } | ||
|
|
||
| /// A tracing `Layer` that forwards tracing events to a given `Logger`. | ||
| pub struct TracingToLogger<L: Deref> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently unused, but demonstrates how we can stay backwards compatible with a Logger impl.
| macro_rules! log_info { | ||
| ($logger: expr, $($arg:tt)*) => ( | ||
| $crate::log_given_level!($logger, $crate::util::logger::Level::Info, $($arg)*); | ||
| tracing::info!($($arg)*); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No logger instance needed....
| tracing::Level::TRACE => "TRACE", | ||
| }; | ||
|
|
||
| let context = format!( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TestLogger compatible output.
| let mut current = Some(span); | ||
| while let Some(s) = current { | ||
| let extensions = s.extensions(); | ||
| if let Some(info) = extensions.get::<NodeInfo>() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't ask too many questions about how this code is getting the node id.... Testing only...
Try out to see how
tracingcan be used instead of the currentLogger. Advantages: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.