Open rcoh opened 1 month ago
Since https://github.com/tokio-rs/tokio/pull/6114 has been merged, we need to resolve conflict here.
Also, perhaps we should stabilize num_active_tasks
instead of active_tasks_count
?
Ah that comment was attempting to refer to spawned_task_count
On Sat, Jun 15, 2024, 3:06 PM Alice Ryhl @.***> wrote:
@.**** commented on this pull request.
In tokio/src/runtime/metrics/runtime.rs https://github.com/tokio-rs/tokio/pull/6619#discussion_r1641407903:
@@ -47,6 +47,29 @@ impl RuntimeMetrics { self.handle.inner.num_workers() }
- /// Returns the current number of active tasks in the runtime.
- ///
- /// This value increases and decreases over time as tasks are spawned and as they are completed or cancelled.
- ///
- /// To see the total number of spawned tasks, see
spawned_tasks_count
. Note that this API currently requires using--cfg tokio_unstable
.If this is being stabilized, then the documentation should no longer say that it's unstable.
— Reply to this email directly, view it on GitHub https://github.com/tokio-rs/tokio/pull/6619#pullrequestreview-2120793789, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADYKZZO5E3NIQNX465VC7LZHSGEFAVCNFSM6AAAAABI5FHB4SVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDCMRQG44TGNZYHE . You are receiving this because you authored the thread.Message ID: @.***>
Okay. It's a bit confusing like this. You don't need to say that it's unstable in the docs for other methods.
I'm sorry for responding slowly here.
I'm wondering whether the name should be something else. The word "active" is the opposite of "idle", but the count includes idle tasks that have not yet exited. How about a name like alive_tasks_count
?
runnable? That has some issues too. I wonder if this would be helped with a TaskMetrics struct that could give some docs to explain the different task states & group the metrics.
On Sun, Jun 30, 2024, 4:46 AM Alice Ryhl @.***> wrote:
I'm sorry for responding slowly here.
I'm wondering whether the name should be something else. The word "active" is the opposite of "idle", but the count includes idle tasks that have not yet exited. How about a name like alive_tasks_count?
— Reply to this email directly, view it on GitHub https://github.com/tokio-rs/tokio/pull/6619#issuecomment-2198515516, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADYKZ5ICVVOKM5II2OKRUTZJ7OXTAVCNFSM6AAAAABI5FHB4SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJYGUYTKNJRGY . You are receiving this because you authored the thread.Message ID: @.***>
I ended up renaming it in #6667.
I don't think runnable works either. That also implies that idle tasks shouldn't be counted, but they are.
Motivation
Stabilize
num_active_tasks
so it can be used outside of--cfg tokio_unstable
Solution
num_active_tasks
num_active_tasks
rt_metrics
intort_metrics
andrt_unstable_metrics
.Refs: #6546