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

Allow Tokio Console support #517

Merged
merged 14 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[build]
rustflags = ["--cfg", "tokio_unstable"]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

to make tokio-console work::

in order to collect task data from Tokio, the tokio_unstable cfg must be enabled.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With the Rust stable version, there hasn't been any problems. The tokio-console command displays just fine, although I was not able to see the histogram.

The worst it could do would be returning a blank view.

Copy link
Member

Choose a reason for hiding this comment

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

This doesn't work for me, unfortunately I have to explicitly pass the RUSTFLAGS="--cfg tokio_unstable" when trying to run or build the client.

I assume it's because I do have a ~/.cargo/config.toml file where I already specify some rust flags

[target.aarch64-apple-darwin]
rustflags = ["-C", "link-arg=-fuse-ld=/opt/homebrew/opt/llvm/bin/ld64.lld"]

and this might override the workspace configuration.

I confirmed this by removing my 'global' config.toml and then recompiling. This worked.

Generally I would prefer if we could enable this tokio-console thing with an extra feature flag and have it disabled by default. Do you think this would be possible @b-yap?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See e77d7ac

I tried to set it through [env] .cargo/config.toml, and it didn't work. All RUSTFLAGS, CARGO_ENCODED_RUSTFLAGS and CARGO_BUILD_FLAGS won't work.

I also tried to do it through a build script and didn't work:

fn main(){
    cfg_if::cfg_if! {
        if #[cfg(feature = "allow-debugger")] {
            println!("cargo:rustc-env=RUSTFLAGS=\"--cfg tokio_unstable\"");
        }
    }
}

and
println!("cargo:rustc-flags=\"--cfg tokio_unstable\"");
as explained in rust-lang/cargo#10141.

In the end I updated the doc to tell the user to set the rustflags themselves.

Loading
Loading