Skip to content

metrics: stabilize num_alive_tasks#6619

Merged
Darksonn merged 4 commits intotokio-rs:masterfrom
rcoh:stabilize-active-tasks
Jul 18, 2024
Merged

metrics: stabilize num_alive_tasks#6619
Darksonn merged 4 commits intotokio-rs:masterfrom
rcoh:stabilize-active-tasks

Conversation

@rcoh
Copy link
Copy Markdown
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 labels Jun 6, 2024
@mox692 mox692 added A-tokio Area: The main tokio crate M-metrics Module: tokio/runtime/metrics labels Jun 7, 2024
@mox692
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

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
Copy Markdown
Contributor Author

rcoh commented Jun 15, 2024 via email

@Darksonn
Copy link
Copy Markdown
Member

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

@rcoh rcoh force-pushed the stabilize-active-tasks branch from 0d087ef to c2b7d9a Compare June 18, 2024 17:07
@Darksonn
Copy link
Copy Markdown
Member

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
Copy Markdown
Contributor Author

rcoh commented Jun 30, 2024 via email

@Darksonn
Copy link
Copy Markdown
Member

I ended up renaming it in #6667.

@Darksonn
Copy link
Copy Markdown
Member

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 rcoh force-pushed the stabilize-active-tasks branch from c2b7d9a to 0fd010f Compare July 18, 2024 14:56
@rcoh rcoh force-pushed the stabilize-active-tasks branch from 0fd010f to fa322a0 Compare July 18, 2024 15:03
@rcoh
Copy link
Copy Markdown
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
Copy Markdown
Member

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
Copy Markdown
Member

@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
This was referenced Jul 22, 2024
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants