From ad7b5ceeec4e7a3861c1c2da71de5b9f28570334 Mon Sep 17 00:00:00 2001 From: Ivan Petkov Date: Sun, 28 Sep 2025 10:40:44 -0700 Subject: [PATCH 1/8] Fix clippy warnings --- console-subscriber/tests/support/subscriber.rs | 3 +-- tokio-console/src/conn.rs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/console-subscriber/tests/support/subscriber.rs b/console-subscriber/tests/support/subscriber.rs index 58a79e685..976c27d4a 100644 --- a/console-subscriber/tests/support/subscriber.rs +++ b/console-subscriber/tests/support/subscriber.rs @@ -207,8 +207,7 @@ async fn console_client(client_stream: DuplexStream, mut test_state: TestState) // We need to return a Result from this async block, which is // why we don't unwrap the `client` here. client.map(TokioIo::new).ok_or_else(|| { - std::io::Error::new( - std::io::ErrorKind::Other, + std::io::Error::other( "console-test error: client already taken. This shouldn't happen.", ) }) diff --git a/tokio-console/src/conn.rs b/tokio-console/src/conn.rs index 8de99b07b..657e5ac49 100644 --- a/tokio-console/src/conn.rs +++ b/tokio-console/src/conn.rs @@ -271,7 +271,7 @@ impl Connection { } } - pub fn render(&self, styles: &crate::view::Styles) -> ratatui::text::Line { + pub fn render(&self, styles: &crate::view::Styles) -> ratatui::text::Line<'_> { use ratatui::{ style::{Color, Modifier}, text::{Line, Span}, From 3986a8886feacc005f3fab4d8a9a4b40ad784931 Mon Sep 17 00:00:00 2001 From: Ivan Petkov Date: Sun, 28 Sep 2025 11:24:03 -0700 Subject: [PATCH 2/8] Fix doc example --- console-subscriber/src/builder.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/console-subscriber/src/builder.rs b/console-subscriber/src/builder.rs index 56b832daf..51dbfd79f 100644 --- a/console-subscriber/src/builder.rs +++ b/console-subscriber/src/builder.rs @@ -187,7 +187,7 @@ impl Builder { /// ``` /// # use console_subscriber::Builder; /// # #[cfg(feature = "vsock")] - /// let builder = Builder::default().server_addr((tokio_vsock::VMADDR_CID_ANY, 6669)); + /// let builder = Builder::default().server_addr(tokio_vsock::VsockAddr::new(tokio_vsock::VMADDR_CID_ANY, 6669)); /// ``` /// /// [environment variable]: `Builder::with_default_env` From f94014db7f87d8a3fbfd8db8d1b47c11792b917a Mon Sep 17 00:00:00 2001 From: Ivan Petkov Date: Mon, 29 Sep 2025 09:07:35 -0700 Subject: [PATCH 3/8] Clean up tonic-web usage It looks like `tonic_web::enable` was removed with the 0.13.x release so this code hasn't actually compiled for a long time. The doc and code examples all use a custom cors layer so whatever heavy lifting the 0.12 method was doing doesn't seem necessary anymore --- console-subscriber/Cargo.toml | 6 ++---- console-subscriber/src/lib.rs | 14 +------------- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/console-subscriber/Cargo.toml b/console-subscriber/Cargo.toml index 271f21ece..0bfd9caed 100644 --- a/console-subscriber/Cargo.toml +++ b/console-subscriber/Cargo.toml @@ -28,7 +28,7 @@ keywords = [ default = ["env-filter"] parking_lot = ["dep:parking_lot", "tracing-subscriber/parking_lot"] env-filter = ["tracing-subscriber/env-filter"] -grpc-web = ["dep:tonic-web"] +grpc-web = [] vsock = ["dep:tokio-vsock"] [dependencies] @@ -54,9 +54,6 @@ serde = { version = "1.0.145", features = ["derive"] } serde_json = "1" crossbeam-channel = "0.5" -# Only for the web feature: -tonic-web = { version = "0.13", optional = true } - # Only for the vsock feature: tokio-vsock = { version = "0.7.1", optional = true, features = ["tonic013"]} @@ -66,6 +63,7 @@ tower = { version = "0.4.12", default-features = false, features = ["util"] } futures = "0.3" http = "1.1" tower-http = { version = "0.5", features = ["cors"] } +tonic-web = "0.13" [lints.rust.unexpected_cfgs] level = "warn" diff --git a/console-subscriber/src/lib.rs b/console-subscriber/src/lib.rs index 944538e4c..eaa8dd572 100644 --- a/console-subscriber/src/lib.rs +++ b/console-subscriber/src/lib.rs @@ -974,16 +974,6 @@ impl Server { /// /// # Examples /// - /// To serve the instrument server with gRPC-Web support with the default - /// settings: - /// - /// ```rust - /// # async fn docs() -> Result<(), Box> { - /// # let (_, server) = console_subscriber::ConsoleLayer::new(); - /// server.serve_with_grpc_web(tonic::transport::Server::default()).await - /// # } - /// ``` - /// /// To serve the instrument server with gRPC-Web support and a custom CORS configuration, use the /// following code: /// @@ -1076,9 +1066,7 @@ impl Server { instrument_server, aggregator, } = self.into_parts(); - let router = builder - .accept_http1(true) - .add_service(tonic_web::enable(instrument_server)); + let router = builder.accept_http1(true).add_service(instrument_server); let aggregate = spawn_named(aggregator.run(), "console::aggregate"); let res = match addr { ServerAddr::Tcp(addr) => { From c3a207694ffd860fd57d434227cce60a81b52920 Mon Sep 17 00:00:00 2001 From: Ivan Petkov Date: Mon, 29 Sep 2025 09:09:54 -0700 Subject: [PATCH 4/8] ci: run clippy with all features enabled Features are additive so this should be safe to lint them all together (and avoid the combinatorics of using cargo-hack) --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 70d31f1b2..d9a0dd24f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -122,7 +122,7 @@ jobs: run: cargo fmt --all -- --check - name: Run cargo clippy - run: cargo clippy --workspace --all-targets --no-deps -- -D warnings + run: cargo clippy --workspace --all-features --all-targets --no-deps -- -D warnings docs: name: Docs From 3ca49b1eb0c8406981556aa47776f7c4f62d9fee Mon Sep 17 00:00:00 2001 From: Ivan Petkov Date: Mon, 29 Sep 2025 09:14:51 -0700 Subject: [PATCH 5/8] ci: run all crate tests in one invocation 1. We've already committed our lockfile so there's no need to test the API/subscriber crates individually (if we want to test with the latest available versions we should be running a `cargo update` in CI, so this change remains compatible with the previous behavior) 2. Also enable some non-default feature flags to ensure they are being tested --- .github/workflows/ci.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d9a0dd24f..402b9ccc4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -71,15 +71,21 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-latest, macos-latest] rust: [stable] + extraFeatures: [vsock] include: + - rust: stable + os: windows-latest + extraFeatures: "" - rust: 1.74.0 os: ubuntu-latest + extraFeatures: vsock # Try to build on the latest nightly. This job is allowed to fail, but # it's useful to help catch bugs in upcoming Rust versions. - rust: nightly os: ubuntu-latest + extraFeatures: vsock steps: - name: Checkout sources uses: actions/checkout@v4 @@ -95,14 +101,8 @@ jobs: with: repo-token: ${{ secrets.GITHUB_TOKEN }} - - name: Run cargo test (API) - run: cargo test -p console-api - - - name: Run cargo test (subscriber) - run: cargo test -p console-subscriber - - - name: Run cargo test (console) - run: cargo test -p tokio-console --locked + - name: Run cargo test + run: cargo test --workspace --locked --features "transport,grpc-web,${{ matrix.extraFeatures }}" lints: name: Lints From 619831e54fb228fb8e4e7b7405b0d517cfd0f94e Mon Sep 17 00:00:00 2001 From: Ivan Petkov Date: Mon, 29 Sep 2025 09:29:59 -0700 Subject: [PATCH 6/8] Fix nix builds --- flake.nix | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index 992a1187a..5485af11b 100644 --- a/flake.nix +++ b/flake.nix @@ -66,12 +66,32 @@ pname = cargoTOML.package.name; version = cargoTOML.package.version; - nativeBuildInputs = [ protobuf ]; + nativeBuildInputs = [ + installShellFiles + protobuf + ]; + + RUSTFLAGS = "--cfg tokio_unstable"; inherit src; cargoLock = { lockFile = "${src}/Cargo.lock"; }; + checkFlags = [ + # tests depend upon git repository at test execution time + "--skip bootstrap" + "--skip config::tests::args_example_changed" + "--skip config::tests::toml_example_changed" + "--skip cli_tests" + ]; + + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + installShellCompletion --cmd tokio-console \ + --bash <($out/bin/tokio-console --log-dir $(mktemp -d) gen-completion bash) \ + --fish <($out/bin/tokio-console --log-dir $(mktemp -d) gen-completion fish) \ + --zsh <($out/bin/tokio-console --log-dir $(mktemp -d) gen-completion zsh) + ''; + meta = { inherit (cargoTOML.package) description homepage license; maintainers = cargoTOML.package.authors; @@ -84,8 +104,7 @@ devShell = with pkgs; mkShell { name = "tokio-console-env"; - buildInputs = tokio-console.buildInputs ++ lib.optional stdenv.isDarwin libiconv; - nativeBuildInputs = tokio-console.nativeBuildInputs; + inputsFrom = [ tokio-console ]; RUST_SRC_PATH = "${rustPlatform.rustLibSrc}"; CARGO_TERM_COLOR = "always"; RUST_BACKTRACE = "full"; @@ -105,5 +124,8 @@ inherit tokio-console; default = self.packages.${system}.tokio-console; }; + checks = { + inherit tokio-console; + }; }); } From c18561c2767e4ba97a337f445953c4f09b35f7f4 Mon Sep 17 00:00:00 2001 From: Ivan Petkov Date: Mon, 29 Sep 2025 09:32:48 -0700 Subject: [PATCH 7/8] flake.lock: Update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'flake-utils': 'github:numtide/flake-utils/cfacdce06f30d2b68473a46042957675eebb3401' (2023-04-11) → 'github:numtide/flake-utils/11707dc2f618dd54ca8739b309ec4fc024de578b' (2024-11-13) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/f9d39fb9aff0efee4a3d5f4a6d7c17701d38a1d8' (2024-02-11) → 'github:NixOS/nixpkgs/e9f00bd893984bc8ce46c895c3bf7cac95331127' (2025-09-28) • Updated input 'rust-overlay': 'github:oxalica/rust-overlay/8dfbe2dffc28c1a18a29ffa34d5d0b269622b158' (2024-02-13) → 'github:oxalica/rust-overlay/be3b8843a2be2411500f6c052876119485e957a2' (2025-09-29) • Removed input 'rust-overlay/flake-utils' --- flake.lock | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/flake.lock b/flake.lock index 75d63b67e..afbb3e410 100644 --- a/flake.lock +++ b/flake.lock @@ -5,11 +5,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1681202837, - "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "owner": "numtide", "repo": "flake-utils", - "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "type": "github" }, "original": { @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1707689078, - "narHash": "sha256-UUGmRa84ZJHpGZ1WZEBEUOzaPOWG8LZ0yPg1pdDF/yM=", + "lastModified": 1759036355, + "narHash": "sha256-0m27AKv6ka+q270dw48KflE0LwQYrO7Fm4/2//KCVWg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "f9d39fb9aff0efee4a3d5f4a6d7c17701d38a1d8", + "rev": "e9f00bd893984bc8ce46c895c3bf7cac95331127", "type": "github" }, "original": { @@ -43,19 +43,16 @@ }, "rust-overlay": { "inputs": { - "flake-utils": [ - "flake-utils" - ], "nixpkgs": [ "nixpkgs" ] }, "locked": { - "lastModified": 1707790272, - "narHash": "sha256-KQXPNl3BLdRbz7xx+mwIq/017fxLRk6JhXHxVWCKsTU=", + "lastModified": 1759113356, + "narHash": "sha256-xm4kEUcV2jk6u15aHazFP4YsMwhq+PczA+Ul/4FDKWI=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "8dfbe2dffc28c1a18a29ffa34d5d0b269622b158", + "rev": "be3b8843a2be2411500f6c052876119485e957a2", "type": "github" }, "original": { From 4d24115a0b64762ca23330af77d3162b8b130b98 Mon Sep 17 00:00:00 2001 From: Ivan Petkov Date: Fri, 26 Sep 2025 09:23:29 -0700 Subject: [PATCH 8/8] flake: drop non-existent override --- flake.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/flake.nix b/flake.nix index 5485af11b..f8ead2d40 100644 --- a/flake.nix +++ b/flake.nix @@ -8,7 +8,6 @@ url = "github:oxalica/rust-overlay"; inputs = { nixpkgs.follows = "nixpkgs"; - flake-utils.follows = "flake-utils"; }; }; };