-
Notifications
You must be signed in to change notification settings - Fork 469
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
add support for tokio-console behind a hidden flag and feature #9665
Conversation
This is in my queue to review! |
Extracted from MaterializeInc#9665. The idea here is to perform the filtering specified by the `--log-filter` argument at the last possible moment, right before the message is emitted to disk. This ensures that other log messages (e.g., trace and debug logs) are available to other parts of the logging subsystem that may want to do something smart with them. This already pays dividends in that the mz_log_message_total metric can keep track of the log messages that don't get written out to the file. It also paves the way for integrations with e.g. the Tokio console (see Co-authored-by: Gus Wynn <[email protected]>
Ok, sorry for the long delay! I split out the
One thing I've wanted to be able to do for a while is dynamically toggle/view the logs at different levels via the web interface (i.e., http://materialized:6875).
In situations like this, it comes out pretty clean if you do:
So, the big hurdle for me here is the additional dependencies on All that said, in this platform world we're probably going to wind up using I am super excited about this! This is exactly the kind of observability we'll need when we go distributed. I think the solution might be involve us doing some work upstream in Prost to make the binary blobs optional. |
Extracted from MaterializeInc#9665. The idea here is to perform the filtering specified by the `--log-filter` argument at the last possible moment, right before the message is emitted to disk. This ensures that other log messages (e.g., trace and debug logs) are available to other parts of the logging subsystem that may want to do something smart with them. This already pays dividends in that the mz_log_message_total metric can keep track of the log messages that don't get written out to the file. It also paves the way for integrations with e.g. the Tokio console (see Co-authored-by: Gus Wynn <[email protected]>
Recording a bit of conversation from Slack for posterity: I've filed tokio-rs/prost#575 to talk about the supply chain issue upstream. I'd like to wait at least a few days/weeks to see what upstream is interested in before we commit the dep to our tree and totally forget about it. But with #9725 hopefully this PR gets good and simple, and the merge conflicts won't be too brutal! |
c32063b
to
6a17959
Compare
I haven't forgotten about this! Once #10079 lands we'll be patching in our own version of prost and this should be safe to land. |
fd0bd82
to
b7b4c05
Compare
|
|
Ok, now its ready to review, please take a look at the |
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.
Hallelujah! Thanks very much for bearing with me on this one. This looks great!
Motivation
the tokio-console was release recently, in beta mode: https://tokio.rs/blog/2021-12-announcing-tokio-console, and in my experience it can be very helpful debugging problems and finding misbehaving tasks. Here is what it looks like in this commit:
and it has already found misbehaving futures that are not yielding:
This pr also refactors our use of
tracing
. We give up the flexibility ofEnvFilter
to use aTargets
per-layer filter, so that events that are not for human consumption are always passed along (to things like the console-subscriber, and our own metrics subscriber): https://docs.rs/tracing-subscriber/0.3.3/tracing_subscriber/struct.EnvFilter.html#examples has more info about this difference.It is entirely possible that we prefer to require users of this flag to have to explicitly add the correct
trace
directive themselves with--log-filter
or the env var.Also, because
.with
returns different, stacked types, its hard to come up with a clean way to optionally add this, so i did the best I couldto run this, you must use something like this:
RUSTFLAGS="--cfg tokio_unstable cargo run --features tokio-console -- --dev --tokio-console
. This unfortunately clashes with things like rust-analyzer, so you will often be rebuilding, but this can be added to.cargo/config
to avoid this.then, use
tokio-console
in another terminal to get the output. In the future, I may go into enforcing that all our tokio tasks are named, so that we can improve this. It might also be interesting to see if we could get timely to spit out the relevant info so that timely operators, which are similarly async, show up on the consoleChecklist
This change is