From 229df4ffddf7442d57ee6512d1529a9af3dc7b36 Mon Sep 17 00:00:00 2001 From: Dominik Nakamura Date: Wed, 10 Jul 2024 23:35:35 +0200 Subject: [PATCH] update: bump tonic to 0.12 Update all dependencies on `tonic` and `tonic-build` to v0.12, along with the related `prost`, `prost-types` and `prost-build` crates to v0.13.1. BREAKING CHANGE: This is a breaking change for users of `console-api` and `console-subscriber`, as it changes the public `tonic`, `prost` and `prost-types` dependency to a semver-incompatible version. This breaks compatibility with `tonic` 0.11.x as well as `prost`/`prost-types` 0.12.x. --- Cargo.lock | 204 +++++++++--------- console-api/Cargo.toml | 10 +- console-api/src/common.rs | 2 - .../generated/rs.tokio.console.async_ops.rs | 1 + .../src/generated/rs.tokio.console.common.rs | 9 +- .../generated/rs.tokio.console.instrument.rs | 39 ++-- .../generated/rs.tokio.console.resources.rs | 1 + .../src/generated/rs.tokio.console.tasks.rs | 3 +- .../src/generated/rs.tokio.console.trace.rs | 30 +-- console-subscriber/Cargo.toml | 13 +- console-subscriber/src/visitors.rs | 20 +- .../tests/support/subscriber.rs | 3 +- tokio-console/Cargo.toml | 7 +- tokio-console/src/conn.rs | 4 +- xtask/Cargo.toml | 2 +- 15 files changed, 171 insertions(+), 177 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 98b23f3b2..ad1ac4e92 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -132,6 +132,12 @@ dependencies = [ "syn 2.0.33", ] +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + [[package]] name = "atty" version = "0.2.14" @@ -151,18 +157,17 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "axum" -version = "0.6.18" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8175979259124331c1d7bf6586ee7e0da434155e4b2d48ec2c8386281d8df39" +checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf" dependencies = [ "async-trait", "axum-core", - "bitflags 1.3.2", "bytes", "futures-util", "http", "http-body", - "hyper", + "http-body-util", "itoa", "matchit", "memchr", @@ -171,7 +176,7 @@ dependencies = [ "pin-project-lite", "rustversion", "serde", - "sync_wrapper", + "sync_wrapper 1.0.1", "tower", "tower-layer", "tower-service", @@ -179,17 +184,20 @@ dependencies = [ [[package]] name = "axum-core" -version = "0.3.4" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" +checksum = "a15c63fd72d41492dc4f497196f5da1fb04fb7529e631d73630d1b491e47a2e3" dependencies = [ "async-trait", "bytes", "futures-util", "http", "http-body", + "http-body-util", "mime", + "pin-project-lite", "rustversion", + "sync_wrapper 0.1.1", "tower-layer", "tower-service", ] @@ -217,9 +225,9 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" [[package]] name = "base64" -version = "0.21.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bitflags" @@ -241,9 +249,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.1.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "cassowary" @@ -421,6 +429,7 @@ dependencies = [ "hdrhistogram", "http", "humantime", + "hyper-util", "parking_lot", "prost", "prost-types", @@ -751,15 +760,15 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "h2" -version = "0.3.26" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" +checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab" dependencies = [ + "atomic-waker", "bytes", "fnv", "futures-core", "futures-sink", - "futures-util", "http", "indexmap 2.1.0", "slab", @@ -820,9 +829,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.9" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" dependencies = [ "bytes", "fnv", @@ -831,20 +840,26 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.5" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" dependencies = [ "bytes", "http", - "pin-project-lite", ] [[package]] -name = "http-range-header" -version = "0.3.1" +name = "http-body-util" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "add0ab9360ddbd88cfeb3bd9574a1d85cfdfa14db10b3e21d3700dbc4328758f" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +dependencies = [ + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", +] [[package]] name = "httparse" @@ -876,13 +891,12 @@ dependencies = [ [[package]] name = "hyper" -version = "0.14.26" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab302d72a6f11a3b910431ff93aae7e773078c769f0a3ef15fb9ec692ed147d4" +checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" dependencies = [ "bytes", "futures-channel", - "futures-core", "futures-util", "h2", "http", @@ -891,23 +905,42 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2", + "smallvec", "tokio", - "tower-service", - "tracing", "want", ] [[package]] name = "hyper-timeout" -version = "0.4.1" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3203a961e5c83b6f5498933e78b6b263e208c197b63e9c6c53cc82ffd3f63793" +dependencies = [ + "hyper", + "hyper-util", + "pin-project-lite", + "tokio", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" +checksum = "3ab92f4f49ee4fb4f997c784b7a2e0fa70050211e0b6a287f898c3c9785ca956" dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", "hyper", "pin-project-lite", + "socket2", "tokio", - "tokio-io-timeout", + "tower", + "tower-service", + "tracing", ] [[package]] @@ -968,15 +1001,6 @@ dependencies = [ "either", ] -[[package]] -name = "itertools" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.12.1" @@ -1303,9 +1327,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.12.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa8473a65b88506c106c28ae905ca4a2b83a2993640467a41bb3080627ddfd2c" +checksum = "e13db3d3fde688c61e2446b4d843bc27a7e8af269a69440c0308021dc92333cc" dependencies = [ "bytes", "prost-derive", @@ -1313,13 +1337,13 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.12.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30d3e647e9eb04ddfef78dfee2d5b3fefdf94821c84b710a3d8ebc89ede8b164" +checksum = "5bb182580f71dd070f88d01ce3de9f4da5021db7115d2e1c3605a754153b77c1" dependencies = [ "bytes", - "heck 0.4.1", - "itertools 0.11.0", + "heck 0.5.0", + "itertools 0.12.1", "log", "multimap", "once_cell", @@ -1330,17 +1354,16 @@ dependencies = [ "regex", "syn 2.0.33", "tempfile", - "which", ] [[package]] name = "prost-derive" -version = "0.12.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56075c27b20ae524d00f247b8a4dc333e5784f889fe63099f8e626bc8d73486c" +checksum = "18bec9b0adc4eba778b33684b7ba3e7137789434769ee3ce3930463ef904cfca" dependencies = [ "anyhow", - "itertools 0.11.0", + "itertools 0.12.1", "proc-macro2", "quote", "syn 2.0.33", @@ -1348,9 +1371,9 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.12.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cebe0a918c97f86c217b0f76fd754e966f8b9f41595095cf7d74cb4e59d730f6" +checksum = "cee5168b05f49d4b0ca581206eb14a7b22fafd963efe729ac48eb03266e25cc2" dependencies = [ "prost", ] @@ -1643,9 +1666,9 @@ checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32" [[package]] name = "smallvec" -version = "1.11.0" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "snapbox" @@ -1675,12 +1698,12 @@ checksum = "8a253e6f894cfa440cba00600a249fa90869d8e0ec45ab274a456e043a0ce8f2" [[package]] name = "socket2" -version = "0.4.9" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" dependencies = [ "libc", - "winapi", + "windows-sys 0.52.0", ] [[package]] @@ -1755,6 +1778,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "20518fe4a4c9acf048008599e464deb21beeae3d3578418951a189c235a7a9a8" +[[package]] +name = "sync_wrapper" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" + [[package]] name = "tempfile" version = "3.10.1" @@ -1823,11 +1852,11 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.28.2" +version = "1.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94d7b1cfd2aa4011f2de74c2c4c63665e27a71006b0a192dcd2710272e73dfa2" +checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" dependencies = [ - "autocfg", + "backtrace", "bytes", "libc", "mio", @@ -1855,6 +1884,7 @@ dependencies = [ "h2", "hdrhistogram", "humantime", + "hyper-util", "once_cell", "prost-types", "ratatui", @@ -1870,21 +1900,11 @@ dependencies = [ "trycmd", ] -[[package]] -name = "tokio-io-timeout" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" -dependencies = [ - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-macros" -version = "2.1.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" dependencies = [ "proc-macro2", "quote", @@ -1939,23 +1959,26 @@ dependencies = [ [[package]] name = "tonic" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76c4eb7a4e9ef9d4763600161f12f5070b92a578e1b634db88a6887844c91a13" +checksum = "f738b6a169a29bca4e39656db89c44a08e09c5b700b896ee9e7459f0652e81dd" dependencies = [ "async-stream", "async-trait", "axum", - "base64 0.21.0", + "base64 0.22.1", "bytes", "h2", "http", "http-body", + "http-body-util", "hyper", "hyper-timeout", + "hyper-util", "percent-encoding", "pin-project", "prost", + "socket2", "tokio", "tokio-stream", "tower", @@ -1966,9 +1989,9 @@ dependencies = [ [[package]] name = "tonic-build" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4ef6dd70a610078cb4e338a0f79d06bc759ff1b22d2120c2ff02ae264ba9c2" +checksum = "690943cc223adcdd67bb597a2e573ead1b88e999ba37528fe8e6356bf44b29b6" dependencies = [ "prettyplease", "proc-macro2", @@ -1979,15 +2002,15 @@ dependencies = [ [[package]] name = "tonic-web" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc3b0e1cedbf19fdfb78ef3d672cb9928e0a91a9cb4629cc0c916e8cff8aaaa1" +checksum = "0d01d7cecf2485d0b7c1555620f5200eba0a1f2f81505158616b8bc6ffba57dc" dependencies = [ - "base64 0.21.0", + "base64 0.22.1", "bytes", "http", "http-body", - "hyper", + "http-body-util", "pin-project", "tokio-stream", "tonic", @@ -2019,17 +2042,15 @@ dependencies = [ [[package]] name = "tower-http" -version = "0.4.4" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61c5bb1d698276a2443e5ecfabc1008bf15a36c12e6a7176e7bf089ea9131140" +checksum = "1e9cd434a998747dd2c4276bc96ee2e0c7a2eadf3cae88e52be55a05fa9053f5" dependencies = [ "bitflags 2.4.0", "bytes", - "futures-core", - "futures-util", "http", "http-body", - "http-range-header", + "http-body-util", "pin-project-lite", "tower-layer", "tower-service", @@ -2264,17 +2285,6 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" -[[package]] -name = "which" -version = "4.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c4fb54e6113b6a8772ee41c3404fb0301ac79604489467e0a9ce1f3e97c24ae" -dependencies = [ - "either", - "lazy_static", - "libc", -] - [[package]] name = "winapi" version = "0.3.9" diff --git a/console-api/Cargo.toml b/console-api/Cargo.toml index 486abe9ba..aa689af4a 100644 --- a/console-api/Cargo.toml +++ b/console-api/Cargo.toml @@ -29,22 +29,22 @@ keywords = [ transport = ["tonic/transport"] [dependencies] -tonic = { version = "0.11", default-features = false, features = [ +tonic = { version = "0.12", default-features = false, features = [ "prost", "codegen", "transport", ] } -prost = "0.12" -prost-types = "0.12" +prost = "0.13.1" +prost-types = "0.13.1" tracing-core = "0.1.17" futures-core = "0.3" [dev-dependencies] -tonic-build = { version = "0.11", default-features = false, features = [ +tonic-build = { version = "0.12", default-features = false, features = [ "prost", "transport" ] } # explicit dep so we can get the version with fixed whitespace. -prost-build = "0.12.0" +prost-build = "0.13.1" [package.metadata.docs.rs] all-features = true diff --git a/console-api/src/common.rs b/console-api/src/common.rs index 732479f49..d367450ad 100644 --- a/console-api/src/common.rs +++ b/console-api/src/common.rs @@ -236,8 +236,6 @@ impl From for u64 { } } -impl Copy for Id {} - impl From for Id { fn from(id: tracing_core::span::Id) -> Self { Id { id: id.into_u64() } diff --git a/console-api/src/generated/rs.tokio.console.async_ops.rs b/console-api/src/generated/rs.tokio.console.async_ops.rs index 42775d26a..9ed29d060 100644 --- a/console-api/src/generated/rs.tokio.console.async_ops.rs +++ b/console-api/src/generated/rs.tokio.console.async_ops.rs @@ -1,3 +1,4 @@ +// This file is @generated by prost-build. /// An `AsyncOp` state update. /// /// This includes a list of any new async ops, and updates to the associated statistics diff --git a/console-api/src/generated/rs.tokio.console.common.rs b/console-api/src/generated/rs.tokio.console.common.rs index 2dd4542de..f2154d120 100644 --- a/console-api/src/generated/rs.tokio.console.common.rs +++ b/console-api/src/generated/rs.tokio.console.common.rs @@ -1,6 +1,7 @@ +// This file is @generated by prost-build. /// Unique identifier for each task. #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct Id { /// The unique identifier's concrete value. #[prost(uint64, tag = "1")] @@ -25,7 +26,7 @@ pub struct Location { } /// Unique identifier for metadata. #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct MetaId { /// The unique identifier's concrete value. #[prost(uint64, tag = "1")] @@ -33,7 +34,7 @@ pub struct MetaId { } /// Unique identifier for spans. #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct SpanId { /// The unique identifier's concrete value. #[prost(uint64, tag = "1")] @@ -273,7 +274,7 @@ pub mod metadata { /// - tasks that have been spawned /// - async operations on resources that are performed within the context of a task #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct PollStats { /// The total number of times this object has been polled. #[prost(uint64, tag = "1")] diff --git a/console-api/src/generated/rs.tokio.console.instrument.rs b/console-api/src/generated/rs.tokio.console.instrument.rs index 978f994fa..0fc2f9723 100644 --- a/console-api/src/generated/rs.tokio.console.instrument.rs +++ b/console-api/src/generated/rs.tokio.console.instrument.rs @@ -1,3 +1,4 @@ +// This file is @generated by prost-build. /// InstrumentRequest requests the stream of updates /// to observe the async runtime state over time. /// @@ -5,12 +6,12 @@ /// only the data that the caller cares about (i.e. only /// tasks but no resources) #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct InstrumentRequest {} /// TaskDetailsRequest requests the stream of updates about /// the specific task identified in the request. #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct TaskDetailsRequest { /// Identifies the task for which details were requested. #[prost(message, optional, tag = "1")] @@ -18,11 +19,11 @@ pub struct TaskDetailsRequest { } /// PauseRequest requests the stream of updates to pause. #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct PauseRequest {} /// ResumeRequest requests the stream of updates to resume after a pause. #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct ResumeRequest {} /// Update carries all information regarding tasks, resources, async operations /// and resource operations in one message. There are a couple of reasons to combine all @@ -56,11 +57,11 @@ pub struct Update { } /// `PauseResponse` is the value returned after a pause request. #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct PauseResponse {} /// `ResumeResponse` is the value returned after a resume request. #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct ResumeResponse {} /// Generated client implementations. pub mod instrument_client { @@ -314,19 +315,17 @@ pub mod instrument_server { /// `InstrumentServer` implements `Instrument` as a service. #[derive(Debug)] pub struct InstrumentServer { - inner: _Inner, + inner: Arc, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, max_decoding_message_size: Option, max_encoding_message_size: Option, } - struct _Inner(Arc); impl InstrumentServer { pub fn new(inner: T) -> Self { Self::from_arc(Arc::new(inner)) } pub fn from_arc(inner: Arc) -> Self { - let inner = _Inner(inner); Self { inner, accept_compression_encodings: Default::default(), @@ -389,7 +388,6 @@ pub mod instrument_server { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { - let inner = self.inner.clone(); match req.uri().path() { "/rs.tokio.console.instrument.Instrument/WatchUpdates" => { #[allow(non_camel_case_types)] @@ -421,7 +419,6 @@ pub mod instrument_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = WatchUpdatesSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -468,7 +465,6 @@ pub mod instrument_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = WatchTaskDetailsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -512,7 +508,6 @@ pub mod instrument_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = PauseSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -556,7 +551,6 @@ pub mod instrument_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = ResumeSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -578,8 +572,11 @@ pub mod instrument_server { Ok( http::Response::builder() .status(200) - .header("grpc-status", "12") - .header("content-type", "application/grpc") + .header("grpc-status", tonic::Code::Unimplemented as i32) + .header( + http::header::CONTENT_TYPE, + tonic::metadata::GRPC_CONTENT_TYPE, + ) .body(empty_body()) .unwrap(), ) @@ -600,16 +597,6 @@ pub mod instrument_server { } } } - impl Clone for _Inner { - fn clone(&self) -> Self { - Self(Arc::clone(&self.0)) - } - } - impl std::fmt::Debug for _Inner { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{:?}", self.0) - } - } impl tonic::server::NamedService for InstrumentServer { const NAME: &'static str = "rs.tokio.console.instrument.Instrument"; } diff --git a/console-api/src/generated/rs.tokio.console.resources.rs b/console-api/src/generated/rs.tokio.console.resources.rs index d9edd03f7..816ec2e3a 100644 --- a/console-api/src/generated/rs.tokio.console.resources.rs +++ b/console-api/src/generated/rs.tokio.console.resources.rs @@ -1,3 +1,4 @@ +// This file is @generated by prost-build. /// A resource state update. /// /// Each `ResourceUpdate` contains any resource data that has changed since the last diff --git a/console-api/src/generated/rs.tokio.console.tasks.rs b/console-api/src/generated/rs.tokio.console.tasks.rs index 41b839681..59a8986d9 100644 --- a/console-api/src/generated/rs.tokio.console.tasks.rs +++ b/console-api/src/generated/rs.tokio.console.tasks.rs @@ -1,3 +1,4 @@ +// This file is @generated by prost-build. /// A task state update. /// /// Each `TaskUpdate` contains any task data that has changed since the last @@ -168,7 +169,7 @@ pub mod task { } /// Task performance statistics. #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct Stats { /// Timestamp of when the task was spawned. #[prost(message, optional, tag = "1")] diff --git a/console-api/src/generated/rs.tokio.console.trace.rs b/console-api/src/generated/rs.tokio.console.trace.rs index 220b55ab6..e496b7ebd 100644 --- a/console-api/src/generated/rs.tokio.console.trace.rs +++ b/console-api/src/generated/rs.tokio.console.trace.rs @@ -1,3 +1,4 @@ +// This file is @generated by prost-build. /// Start watching trace events with the provided filter. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -26,7 +27,7 @@ pub mod trace_event { } /// `Enter` signals that a span was entered. #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] + #[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct Enter { /// `span_id` identifies the span that was entered. #[prost(message, optional, tag = "1")] @@ -40,7 +41,7 @@ pub mod trace_event { } /// `Exit` signals that a span was exited. #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] + #[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct Exit { /// `span_id` identifies the span that was exited. #[prost(message, optional, tag = "1")] @@ -54,7 +55,7 @@ pub mod trace_event { } /// `Close` signals that a span was closed. #[allow(clippy::derive_partial_eq_without_eq)] - #[derive(Clone, PartialEq, ::prost::Message)] + #[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct Close { /// `span_id` identifies the span that was closed. #[prost(message, optional, tag = "1")] @@ -223,19 +224,17 @@ pub mod trace_server { /// Allows observers to stream trace events for a given `WatchRequest` filter. #[derive(Debug)] pub struct TraceServer { - inner: _Inner, + inner: Arc, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, max_decoding_message_size: Option, max_encoding_message_size: Option, } - struct _Inner(Arc); impl TraceServer { pub fn new(inner: T) -> Self { Self::from_arc(Arc::new(inner)) } pub fn from_arc(inner: Arc) -> Self { - let inner = _Inner(inner); Self { inner, accept_compression_encodings: Default::default(), @@ -298,7 +297,6 @@ pub mod trace_server { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { - let inner = self.inner.clone(); match req.uri().path() { "/rs.tokio.console.trace.Trace/Watch" => { #[allow(non_camel_case_types)] @@ -330,7 +328,6 @@ pub mod trace_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = WatchSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -352,8 +349,11 @@ pub mod trace_server { Ok( http::Response::builder() .status(200) - .header("grpc-status", "12") - .header("content-type", "application/grpc") + .header("grpc-status", tonic::Code::Unimplemented as i32) + .header( + http::header::CONTENT_TYPE, + tonic::metadata::GRPC_CONTENT_TYPE, + ) .body(empty_body()) .unwrap(), ) @@ -374,16 +374,6 @@ pub mod trace_server { } } } - impl Clone for _Inner { - fn clone(&self) -> Self { - Self(Arc::clone(&self.0)) - } - } - impl std::fmt::Debug for _Inner { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{:?}", self.0) - } - } impl tonic::server::NamedService for TraceServer { const NAME: &'static str = "rs.tokio.console.trace.Trace"; } diff --git a/console-subscriber/Cargo.toml b/console-subscriber/Cargo.toml index 9c3c771cf..6936a56f5 100644 --- a/console-subscriber/Cargo.toml +++ b/console-subscriber/Cargo.toml @@ -36,7 +36,7 @@ tokio = { version = "^1.21", features = ["sync", "time", "macros", "tracing"] } tokio-stream = { version = "0.1", features = ["net"] } thread_local = "1.1.3" console-api = { version = "0.7.0", path = "../console-api", features = ["transport"] } -tonic = { version = "0.11", features = ["transport"] } +tonic = { version = "0.12", features = ["transport"] } tracing-core = "0.1.24" tracing = "0.1.26" tracing-subscriber = { version = "0.3.17", default-features = false, features = ["fmt", "registry"] } @@ -46,8 +46,9 @@ hdrhistogram = { version = "7.3.0", default-features = false, features = ["seria # feature to also enable `tracing-subscriber`'s parking_lot feature flag. parking_lot_crate = { package = "parking_lot", version = "0.12", optional = true } humantime = "2.1.0" -prost = "0.12" -prost-types = "0.12.0" +prost = "0.13.1" +prost-types = "0.13.1" +hyper-util = { version = "0.1.6", features = ["tokio"] } # Required for recording: serde = { version = "1", features = ["derive"] } @@ -55,14 +56,14 @@ serde_json = "1" crossbeam-channel = "0.5" # Only for the web feature: -tonic-web = { version = "0.11", optional = true } +tonic-web = { version = "0.12", optional = true } [dev-dependencies] tokio = { version = "^1.21", features = ["full", "rt-multi-thread"] } tower = { version = "0.4", default-features = false } futures = "0.3" -http = "0.2" -tower-http = { version = "0.4", features = ["cors"] } +http = "1.1" +tower-http = { version = "0.5", features = ["cors"] } [package.metadata.docs.rs] all-features = true diff --git a/console-subscriber/src/visitors.rs b/console-subscriber/src/visitors.rs index 20458e6b0..2b0e43057 100644 --- a/console-subscriber/src/visitors.rs +++ b/console-subscriber/src/visitors.rs @@ -308,7 +308,7 @@ impl Visit for FieldVisitor { self.fields.push(proto::Field { name: Some(field.name().into()), value: Some(value.into()), - metadata_id: Some(self.meta_id.clone()), + metadata_id: Some(self.meta_id), }); } @@ -316,7 +316,7 @@ impl Visit for FieldVisitor { self.fields.push(proto::Field { name: Some(field.name().into()), value: Some(value.into()), - metadata_id: Some(self.meta_id.clone()), + metadata_id: Some(self.meta_id), }); } @@ -324,7 +324,7 @@ impl Visit for FieldVisitor { self.fields.push(proto::Field { name: Some(field.name().into()), value: Some(value.into()), - metadata_id: Some(self.meta_id.clone()), + metadata_id: Some(self.meta_id), }); } @@ -332,7 +332,7 @@ impl Visit for FieldVisitor { self.fields.push(proto::Field { name: Some(field.name().into()), value: Some(value.into()), - metadata_id: Some(self.meta_id.clone()), + metadata_id: Some(self.meta_id), }); } @@ -340,7 +340,7 @@ impl Visit for FieldVisitor { self.fields.push(proto::Field { name: Some(field.name().into()), value: Some(value.into()), - metadata_id: Some(self.meta_id.clone()), + metadata_id: Some(self.meta_id), }); } } @@ -473,7 +473,7 @@ impl Visit for StateUpdateVisitor { self.field = Some(proto::Field { name: Some(field.name().into()), value: Some(value.into()), - metadata_id: Some(self.meta_id.clone()), + metadata_id: Some(self.meta_id), }); } } @@ -485,7 +485,7 @@ impl Visit for StateUpdateVisitor { self.field = Some(proto::Field { name: Some(field.name().into()), value: Some(value.into()), - metadata_id: Some(self.meta_id.clone()), + metadata_id: Some(self.meta_id), }); } } @@ -497,7 +497,7 @@ impl Visit for StateUpdateVisitor { self.field = Some(proto::Field { name: Some(field.name().into()), value: Some(value.into()), - metadata_id: Some(self.meta_id.clone()), + metadata_id: Some(self.meta_id), }); } } @@ -509,7 +509,7 @@ impl Visit for StateUpdateVisitor { self.field = Some(proto::Field { name: Some(field.name().into()), value: Some(value.into()), - metadata_id: Some(self.meta_id.clone()), + metadata_id: Some(self.meta_id), }); } } @@ -528,7 +528,7 @@ impl Visit for StateUpdateVisitor { self.field = Some(proto::Field { name: Some(field.name().into()), value: Some(value.into()), - metadata_id: Some(self.meta_id.clone()), + metadata_id: Some(self.meta_id), }); } } diff --git a/console-subscriber/tests/support/subscriber.rs b/console-subscriber/tests/support/subscriber.rs index ba1aac489..58a79e685 100644 --- a/console-subscriber/tests/support/subscriber.rs +++ b/console-subscriber/tests/support/subscriber.rs @@ -6,6 +6,7 @@ use console_api::{ }; use console_subscriber::ServerParts; use futures::stream::StreamExt; +use hyper_util::rt::TokioIo; use tokio::{io::DuplexStream, task}; use tonic::transport::{Channel, Endpoint, Server, Uri}; use tower::service_fn; @@ -205,7 +206,7 @@ async fn console_client(client_stream: DuplexStream, mut test_state: TestState) async move { // We need to return a Result from this async block, which is // why we don't unwrap the `client` here. - client.ok_or_else(|| { + client.map(TokioIo::new).ok_or_else(|| { std::io::Error::new( std::io::ErrorKind::Other, "console-test error: client already taken. This shouldn't happen.", diff --git a/tokio-console/Cargo.toml b/tokio-console/Cargo.toml index a6bcf4162..dc64c6f5d 100644 --- a/tokio-console/Cargo.toml +++ b/tokio-console/Cargo.toml @@ -37,27 +37,28 @@ console-api = { version = "0.7.0", path = "../console-api", features = ["transpo clap = { version = "~4.5.4", features = ["wrap_help", "cargo", "derive", "env"] } clap_complete = "~4.5.2" tokio = { version = "1", features = ["full", "rt-multi-thread"] } -tonic = { version = "0.11", features = ["transport"] } +tonic = { version = "0.12", features = ["transport"] } futures = "0.3" ratatui = { version = "0.26.2", default-features = false, features = ["crossterm"] } tower = "0.4.12" tracing = "0.1" tracing-subscriber = { version = "0.3" } tracing-journald = { version = "0.2", optional = true } -prost-types = "0.12" +prost-types = "0.13.1" crossterm = { version = "0.27.0", features = ["event-stream"] } color-eyre = { version = "0.6", features = ["issue-url"] } hdrhistogram = { version = "7.3.0", default-features = false, features = ["serialization"] } # Keep this in sync with the version from `tonic`. # Because we inspect the error from tonic, we need to make sure that the # version of h2 we use is compatible with the version of tonic we use. -h2 = "0.3" +h2 = "0.4" regex = "1.5" once_cell = "1.8" humantime = "2.1.0" serde = { version = "1", features = ["derive"] } toml = "0.5" dirs = "5" +hyper-util = { version = "0.1.6", features = ["tokio"] } [dev-dependencies] # Use 1.64.0 compatible version of `trycmd@0.13.6`. diff --git a/tokio-console/src/conn.rs b/tokio-console/src/conn.rs index 471035c19..03fb88e30 100644 --- a/tokio-console/src/conn.rs +++ b/tokio-console/src/conn.rs @@ -4,6 +4,8 @@ use console_api::instrument::{ }; use console_api::tasks::TaskDetails; use futures::stream::StreamExt; +use futures::TryFutureExt; +use hyper_util::rt::TokioIo; use std::{error::Error, time::Duration}; #[cfg(unix)] use tokio::net::UnixStream; @@ -94,7 +96,7 @@ impl Connection { let endpoint = Endpoint::from_static("http://localhost"); endpoint .connect_with_connector(tower::service_fn(move |_| { - UnixStream::connect(path.clone()) + UnixStream::connect(path.clone()).map_ok(TokioIo::new) })) .await? } diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index ecc532320..74fc81d88 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -7,7 +7,7 @@ rust-version = "1.74.0" publish = false [dependencies] -tonic-build = { version = "0.11", default-features = false, features = [ +tonic-build = { version = "0.12", default-features = false, features = [ "prost", "transport" ] } clap = { version = "~4.5.4", features = ["derive"] }