Repository: tokio-rs/tokio
File: tokio/src/runtime/metrics/runtime.rs (Rust)

Code before:
    ///
    /// The number of workers is set by configuring `max_blocking_threads` on
    /// `runtime::Builder`.
    ///
    /// # Examples
    ///
    /// ```
    /// use tokio::runtime::Handle;
    ///
    /// #[tokio::main]
    /// async fn main() {
    ///     let _ = tokio::task::spawn_blocking(move || {
    ///         // Stand-in for compute-heavy work or using synchronous APIs
    ///         1 + 1
    ///     }).await;
    ///     let metrics = Handle::current().metrics();
    ///
    ///     let n = metrics.num_blocking_threads();
    ///     println!("Runtime has created {} threads", n);
    /// }
    /// ```
    pub fn num_blocking_threads(&self) -> usize {
        self.handle.inner.num_blocking_threads()
    }

    #[deprecated]
    /// Renamed to [`RuntimeMetrics::num_active_tasks`]
    pub fn active_tasks_count(&self) -> usize {
        self.num_active_tasks()
    }

    /// 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.
    ///
    /// # Examples
    ///
    /// ```
    /// use tokio::runtime::Handle;
    ///
    /// #[tokio::main]
    /// async fn main() {
    ///    let metrics = Handle::current().metrics();
    ///
    ///     let n = metrics.num_active_tasks();
    ///     println!("Runtime has {} active tasks", n);
    /// }
    /// ```
    pub fn num_active_tasks(&self) -> usize {
        self.handle.inner.active_tasks_count()
    }

Review comment (suggestion):
```suggestion
    #[deprecated = "Renamed to num_active_tasks"]
```

Code after:
        self.handle.inner.num_workers()
    }

    cfg_unstable_metrics! {

        /// Returns the number of additional threads spawned by the runtime.
        ///
        /// The number of workers is set by configuring `max_blocking_threads` on
        /// `runtime::Builder`.
        ///
        /// # Examples
        ///
        /// ```
        /// use tokio::runtime::Handle;
        ///
        /// #[tokio::main]
        /// async fn main() {
        ///     let _ = tokio::task::spawn_blocking(move || {
        ///         // Stand-in for compute-heavy work or using synchronous APIs
        ///         1 + 1
        ///     }).await;
        ///     let metrics = Handle::current().metrics();
        ///
        ///     let n = metrics.num_blocking_threads();
        ///     println!("Runtime has created {} threads", n);
        /// }
        /// ```
        pub fn num_blocking_threads(&self) -> usize {
            self.handle.inner.num_blocking_threads()
        }

        #[deprecated = "Renamed to num_active_tasks"]
        /// Renamed to [`RuntimeMetrics::num_active_tasks`]
        pub fn active_tasks_count(&self) -> usize {
            self.num_active_tasks()
        }

        /// 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.
        ///
        /// # Examples
        ///
        /// ```
        /// use tokio::runtime::Handle;
        ///
        /// #[tokio::main]
        /// async fn main() {
        ///    let metrics = Handle::current().metrics();
        ///
        ///     let n = metrics.num_active_tasks();