Skip to content

task: opens Id::as_u64 to clients #7454

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aaronjeline
Copy link

Allows clients to observe the contents of Task IDs, with no guarantees on contents.

Fixes: #7430

Motivation

Solves the ask in the referenced issue (#7430) to allow a lightweight/cheap way to see the contents of a task Id.

Solution

Simply opens task::Id::as_u64 to pub instead of pub(crate)

Allows clients to observe the contents of Task IDs,
with no guarantees on contents.

Fixes: tokio-rs#7430
@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 Jul 11, 2025
@aaronjeline
Copy link
Author

If maintainers would prefer this being on the tokio_unstable feature happy to change that

@ADD-SP ADD-SP added C-enhancement Category: A PR with an enhancement or bugfix. A-tokio Area: The main tokio crate M-runtime Module: tokio/runtime labels Jul 11, 2025
Copy link
Member

@ADD-SP ADD-SP left a comment

Choose a reason for hiding this comment

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

#7430 wants to expose this method for getting rid of the ugly unsafe hack of tokio-dtrace, would you mind talking about your requirements?

We currently has no enough motivation to expose a stable representation of task id.

An alternative is gating this method by tokio_unstable.

However, my feeling is that once we open up the this unstable method, it will end up being used so heavily in the observability infrastructure, leading to a lot of resistance when we try to break this interface in the future, even this is tokio_unstable.

@aaronjeline
Copy link
Author

Looks like the big requirement is being able to observe a task id without allocating

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 C-enhancement Category: A PR with an enhancement or bugfix. M-runtime Module: tokio/runtime 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.

consider adding task::Id to u64 conversion
3 participants