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

Some unstable runtime metrics show up as stable in docs.rs #6745

Open
xd009642 opened this issue Aug 2, 2024 · 7 comments · May be fixed by #6747
Open

Some unstable runtime metrics show up as stable in docs.rs #6745

xd009642 opened this issue Aug 2, 2024 · 7 comments · May be fixed by #6747
Assignees
Labels
A-tokio Area: The main tokio crate C-bug Category: This is a bug. E-help-wanted Call for participation: Help is requested to fix this issue. M-metrics Module: tokio/runtime/metrics T-docs Topic: documentation

Comments

@xd009642
Copy link
Contributor

xd009642 commented Aug 2, 2024

In the tokio RuntimeMetrics docs the majority of metrics require --cfg=tokio_unstable. Howver, some also require a target architecture with 64 bit atomics. For metrics which require both of these features rustdoc only shows one of them. Linked is an example: docs.rs/tokio/latest/tokio/runtime/struct.RuntimeMetrics.html#method.spawned_tasks_count

Here it says "Available on target_has_atomic="64" only." But it should say something like "Only available with target_has_atomic="64" and tokio_unstable."

This is a replica of the issue I raised in rust doc rust-lang/rust#128563 . This is also extra misleading as number of workers has been stabilised so it's no longer the case that all metrics are unstable.

@xd009642 xd009642 added A-tokio Area: The main tokio crate C-bug Category: This is a bug. labels Aug 2, 2024
@Darksonn Darksonn added E-help-wanted Call for participation: Help is requested to fix this issue. T-docs Topic: documentation M-metrics Module: tokio/runtime/metrics labels Aug 2, 2024
@xd009642
Copy link
Contributor Author

xd009642 commented Aug 2, 2024

So there was a response on the rust issue, it's an issue tokio side because the nested config macros apply to the inner macro not the definitions inside

@SarthakPaandey
Copy link

As a newcomer looking to contribute to the project, I am interested in working on this issue.

I believe I can help clarify and update the documentation to accurately reflect the stability requirements for metrics that depend on both --cfg=tokio_unstable and target_has_atomic="64".

Could @Darksonn please assign me this task and guide me on how I can get started with this task? Any pointers on where to look for relevant code or documentation files would be greatly appreciated.

@Darksonn
Copy link
Contributor

Darksonn commented Aug 4, 2024

The relevant file is tokio/src/runtime/metrics/runtime.rs. The cfg_* macros are defined in tokio/src/macros/cfg.rs.

The problem seems to be that combining multiple cfg_* macros does not work properly in the docs. Anything inside cfg_a! { cfg_b! { ... } } will appear in the documentation as-if it only requires b and not a.

You are very welcome to reach out to me on the Tokio discord to discuss further.

@SarthakPaandey
Copy link

what is the Tokio discord channel link?

@SarthakPaandey
Copy link

In the documentation of runtime.rs I am not able to see the Available portion where would i be able to find that @Darksonn . Could you please guide?

@Darksonn
Copy link
Contributor

Darksonn commented Aug 4, 2024

The link is: https://discord.gg/tokio

@SarthakPaandey
Copy link

@Darksonn,
I’ve created a PR to address the documentation issue by adding comments to runtime.rs to describe the dependencies more clearly. You can find the PR [here.]
The comments provide additional context regarding the dependencies required for certain metrics and how they should be represented in the documentation. Please review the PR and let me know if there are any further adjustments needed.
Kindly merge it for now so that users can understand that it requires both.
Thanks!

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-bug Category: This is a bug. E-help-wanted Call for participation: Help is requested to fix this issue. M-metrics Module: tokio/runtime/metrics T-docs Topic: documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants