First class notion of runtimes #130
Labels
A-instrumentation
Area: instrumentation.
A-recording
Area: recording.
C-api
Crate: console-api
C-console
Crate: console.
C-subscriber
Crate: console-subscriber.
S-feature
Severity: feature. This is adding a new feature.
A Tokio application is capable of having multiple independent runtimes. I believe this may be the case for other runtime implementations as well (e.g., I believe
rayon
allows creating multiple separate threadpools). This may also be useful when a crate uses multiple async runtimes provided by different libraries (e.g. runningasync-std
s global runtime in a bg thread).Currently, the console has no way of being aware of this --- we just see a lot of tasks, without any way of determining which runtime a task is running on. It would be nice to be able to tag tasks with runtimes. In the future, when we add runtime-global stats/metrics, we will also want a way to uniquely identify runtimes.
As a first pass, we could consider adding a field to the task spans in Tokio with some kind of runtime ID (could just increment an integer every time
Runtime::new
is called), and add that to the task spans when spawning. This would at least let users distinguish between runtimes by looking at the task's fields. Tokio could also add a new (unstable) builder method to allow naming the runtime itself, as well as naming its worker threads.Building on that, we could make the console subscriber actually aware of this field, and allow associating tasks with runtimes. We could consider adding a new RPC to list runtimes and/or get per-runtime stats.
The text was updated successfully, but these errors were encountered: