Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metrics: stabilize num_alive_tasks #6619

Merged
merged 4 commits into from
Jul 18, 2024

Conversation

rcoh
Copy link
Contributor

@rcoh rcoh commented Jun 6, 2024

Motivation

Stabilize num_active_tasks num_alive_tasks so it can be used outside of --cfg tokio_unstable

Solution

  1. stabilize num_alive_tasks
  2. Rename internal fields to match num_alive_tasks
  3. Split rt_metrics into rt_metrics and rt_unstable_metrics.

Refs: #6546

@github-actions github-actions bot added R-loom-current-thread Run loom current-thread tests on this PR R-loom-multi-thread Run loom multi-thread tests on this PR R-loom-multi-thread-alt Run loom multi-thread alt tests on this PR labels Jun 6, 2024
@mox692 mox692 added A-tokio Area: The main tokio crate M-metrics Module: tokio/runtime/metrics labels Jun 7, 2024
tokio/tests/rt_metrics.rs Outdated Show resolved Hide resolved
@mox692
Copy link
Member

mox692 commented Jun 10, 2024

Since #6114 has been merged, we need to resolve conflict here.
Also, perhaps we should stabilize num_active_tasks instead of active_tasks_count?

@rcoh rcoh force-pushed the stabilize-active-tasks branch 3 times, most recently from 3542c59 to 0d087ef Compare June 14, 2024 16:09
Copy link
Member

@mox692 mox692 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

///
/// 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`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is being stabilized, then the documentation should no longer say that it's unstable.

@rcoh
Copy link
Contributor Author

rcoh commented Jun 15, 2024 via email

@Darksonn
Copy link
Contributor

Okay. It's a bit confusing like this. You don't need to say that it's unstable in the docs for other methods.

@Darksonn
Copy link
Contributor

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?

@rcoh
Copy link
Contributor Author

rcoh commented Jun 30, 2024 via email

@Darksonn
Copy link
Contributor

I ended up renaming it in #6667.

@Darksonn
Copy link
Contributor

I don't think runnable works either. That also implies that idle tasks shouldn't be counted, but they are.

rcoh added 2 commits July 18, 2024 14:48
1. stabilize `num_active_tasks`
2. Rename internal counters to match `num_active_tasks`
3. Split `rt_metrics` into `rt_metrics` and `rt_unstable_metrics`.
@rcoh
Copy link
Contributor Author

rcoh commented Jul 18, 2024

Sorry for the delay on this. @Darksonn I've rebased. I noticed there was a mix between alive_tasks_count and num_alive_tasks — would you like me to unify them or leave as is?

@Darksonn
Copy link
Contributor

That makes sense. The publicly used name is num_alive_tasks, so let's rename the internal things called alive_tasks_count to num_alive_tasks.

Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

@Darksonn Darksonn changed the title metrics: Stabilize active_task_count metrics: stabilize num_alive_tasks Jul 18, 2024
@Darksonn Darksonn merged commit 1be8a8e into tokio-rs:master Jul 18, 2024
83 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate M-metrics Module: tokio/runtime/metrics R-loom-current-thread Run loom current-thread tests on this PR R-loom-multi-thread Run loom multi-thread tests on this PR R-loom-multi-thread-alt Run loom multi-thread alt tests on this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants