-
-
Notifications
You must be signed in to change notification settings - Fork 165
First class notion of runtimes #130
Copy link
Copy link
Open
Labels
A-instrumentationArea: instrumentation.Area: instrumentation.A-recordingArea: recording.Area: recording.C-apiCrate: console-apiCrate: console-apiC-consoleCrate: console.Crate: console.C-subscriberCrate: console-subscriber.Crate: console-subscriber.S-featureSeverity: feature. This is adding a new feature.Severity: feature. This is adding a new feature.
Metadata
Metadata
Assignees
Labels
A-instrumentationArea: instrumentation.Area: instrumentation.A-recordingArea: recording.Area: recording.C-apiCrate: console-apiCrate: console-apiC-consoleCrate: console.Crate: console.C-subscriberCrate: console-subscriber.Crate: console-subscriber.S-featureSeverity: feature. This is adding a new 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
rayonallows creating multiple separate threadpools). This may also be useful when a crate uses multiple async runtimes provided by different libraries (e.g. runningasync-stds 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::newis 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.