API for number of active tokio tasks? #5400
Labels
A-tokio
Area: The main tokio crate
C-feature-request
Category: A feature request.
M-metrics
Module: tokio/runtime/metrics
Is your feature request related to a problem? Please describe.
I would like to get the count of active running tokio tasks. In python, I can use
len(asyncio.all_tasks())
which returns the unfinished tasks for the current running loop.Describe the solution you'd like
A simple associated function such as
tokio::active_tasks()
which could return the number or as withasyncio.all_tasks()
return a set of not yet finished Task objects run by the loop.Describe alternatives you've considered
There are debugging tools such as tokio-rs/console or tracing which helps achieve the same but they are mainly suited for debugging purpose. Is there a way to get those information in production?
Additional context
Originally asked as question on stackoverflow
The text was updated successfully, but these errors were encountered: