-
Notifications
You must be signed in to change notification settings - Fork 148
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
pruntime: Structured logging with tracing #1199
Conversation
Very useful and looks promising |
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.
Nice. Also simplified a lot of logging code.
@@ -17,6 +17,7 @@ LD_LIBRARY_PATH = "/lib:/lib/x86_64-linux-gnu" | |||
MALLOC_ARENA_MAX = "1" | |||
ROCKET_WORKERS = "8" | |||
PINK_RUNTIME_PATH = "{{ pink_runtime_mount_dir }}" | |||
RUST_LOG_SANITIZED = "true" |
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.
How about document it somewhere?
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.
Didn't find a good place elsewhere. Let me just add some comments to this file.
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.
Maybe we can create a simple doc file for pruntime startup flags.
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.
Added docs/pruntime-flags.md
Log lines for concurrent requests are intermixed making it difficult to trace the logic flow. The PR replaces some logs with the
tracing
crate so that we get structured log lines that can be far easier to understand.The log looks like this:
As you can see there is a line
id=114
that is mixed between 119 and 120.How it works:
tracing
is designed for structured logging. It can set stacked spans as the scope of each log printing.tracing_subscriber::fmt
instead ofenv_logger
to init the logger. Thetracing_subscriber::fmt
is a tracing-subscriber fortracing
that prints logs to the console just likeenv_logger
tolog
.tracing_subscriber::fmt
is also a logger forlog
which bridges thelog::*
to thetracing
framework.id
so that we can clearly see each log line is printed within which RPC request. (We do this because the Rocket framework itself doesn't support tracing so far. There is a draft PR, but got inactive for a long time)