From 774e742a50e693cce3ef1e96b974f98c7b17b994 Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Tue, 9 May 2023 09:46:25 -0700 Subject: [PATCH 1/3] feat(console-api): update `tonic` to v0.9 (#420) This commit updates the Tonic dependency for `console-api` from v0.8 to v0.9. BREAKING CHANGE: This is a breaking change for users of `console-api`, as it changes the public `tonic` dependency to a semver-incompatible version. This breaks compatibility with `tonic` 0.8. --- Cargo.lock | 230 ++++++++++-------- console-api/Cargo.toml | 6 +- .../generated/rs.tokio.console.async_ops.rs | 29 ++- .../src/generated/rs.tokio.console.common.rs | 132 +++++++--- .../generated/rs.tokio.console.instrument.rs | 179 +++++++++++--- .../generated/rs.tokio.console.resources.rs | 71 ++++-- .../src/generated/rs.tokio.console.tasks.rs | 82 ++++--- .../src/generated/rs.tokio.console.trace.rs | 108 ++++++-- xtask/Cargo.toml | 2 +- 9 files changed, 565 insertions(+), 274 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6d18a76e8..ba1dbca64 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -43,34 +43,35 @@ checksum = "4361135be9122e0870de935d7c439aef945b9f9ddd4199a553b5270b49c82a27" [[package]] name = "async-stream" -version = "0.3.3" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dad5c83079eae9969be7fadefe640a1c566901f05ff91ab221de4b6f68d9507e" +checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" dependencies = [ "async-stream-impl", "futures-core", + "pin-project-lite", ] [[package]] name = "async-stream-impl" -version = "0.3.3" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10f203db73a71dfa2fb6dd22763990fa26f3d2625a6da2da900d23b87d26be27" +checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.15", ] [[package]] name = "async-trait" -version = "0.1.53" +version = "0.1.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed6aa3524a2dfcf9fe180c51eae2b58738348d819517ceadf95789c51fff7600" +checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.15", ] [[package]] @@ -92,9 +93,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "axum" -version = "0.5.0" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5611d4977882c5af1c0f7a34d51b5d87f784f86912bb543986b014ea4995ef93" +checksum = "f8175979259124331c1d7bf6586ee7e0da434155e4b2d48ec2c8386281d8df39" dependencies = [ "async-trait", "axum-core", @@ -110,20 +111,19 @@ dependencies = [ "mime", "percent-encoding", "pin-project-lite", + "rustversion", "serde", "sync_wrapper", - "tokio", "tower", - "tower-http", "tower-layer", "tower-service", ] [[package]] name = "axum-core" -version = "0.2.0" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95cd109b3e93c9541dcce5b0219dcf89169dcc58c1bebed65082808324258afb" +checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" dependencies = [ "async-trait", "bytes", @@ -131,6 +131,9 @@ dependencies = [ "http", "http-body", "mime", + "rustversion", + "tower-layer", + "tower-service", ] [[package]] @@ -154,6 +157,12 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +[[package]] +name = "base64" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" + [[package]] name = "bitflags" version = "1.3.2" @@ -226,7 +235,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn", + "syn 1.0.90", ] [[package]] @@ -273,7 +282,7 @@ dependencies = [ "prost", "prost-build", "prost-types", - "tonic", + "tonic 0.9.2", "tonic-build", "tracing-core", ] @@ -295,7 +304,7 @@ dependencies = [ "thread_local", "tokio", "tokio-stream", - "tonic", + "tonic 0.8.3", "tracing", "tracing-core", "tracing-subscriber", @@ -491,7 +500,7 @@ checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.90", ] [[package]] @@ -572,7 +581,7 @@ version = "7.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "31672b7011be2c4f7456c4ddbcb40e7e9a4a9fad8efe49a6ebaf5f307d0109c0" dependencies = [ - "base64", + "base64 0.13.0", "byteorder", "flate2", "nom", @@ -596,9 +605,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.6" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f4c6746584866f0feabcc69893c5b51beef3831656a968ed7ae254cdc4fd03" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" dependencies = [ "bytes", "fnv", @@ -607,26 +616,20 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ff4f84919677303da5f147645dbea6b1881f368d03ac84e1dc09031ebd7b2c6" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ "bytes", "http", "pin-project-lite", ] -[[package]] -name = "http-range-header" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bfe8eed0a9285ef776bb792479ea3834e8b94e13d615c2f66d03dd50a435a29" - [[package]] name = "httparse" -version = "1.6.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9100414882e15fb7feccb4897e5f0ff0ff1ca7d1a86a23208ada4d7a18e6c6c4" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" [[package]] name = "httpdate" @@ -642,9 +645,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.18" +version = "0.14.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b26ae0a80afebe130861d90abf98e3814a4f28a4c6ffeb5ab8ebb2be311e0ef2" +checksum = "ab302d72a6f11a3b910431ff93aae7e773078c769f0a3ef15fb9ec692ed147d4" dependencies = [ "bytes", "futures-channel", @@ -723,9 +726,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.1" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" +checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" [[package]] name = "lazy_static" @@ -735,9 +738,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.121" +version = "0.2.144" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f" +checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" [[package]] name = "lock_api" @@ -775,9 +778,9 @@ checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" [[package]] name = "matchit" -version = "0.5.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73cbba799671b762df5a175adf59ce145165747bb891505c43d09aefbbf38beb" +checksum = "b87248edafb776e59e6ee64a79086f65890d3510f2c656c000bf2a7e8a0aea40" [[package]] name = "memchr" @@ -978,22 +981,22 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.0.10" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58ad3879ad3baf4e44784bc6a718a8698867bb991f8ce24d1bcbe2cfb4c3a75e" +checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.0.10" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "744b6f092ba29c3650faf274db506afd39944f48420f6c86b17cfe0ee1cb36bb" +checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.90", ] [[package]] @@ -1021,7 +1024,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b83ec2d0af5c5c556257ff52c9f98934e243b9fd39604bfb2a9b75ec2e97f18" dependencies = [ "proc-macro2", - "syn", + "syn 1.0.90", ] [[package]] @@ -1033,7 +1036,7 @@ dependencies = [ "proc-macro-error-attr", "proc-macro2", "quote", - "syn", + "syn 1.0.90", "version_check", ] @@ -1050,18 +1053,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.36" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" +checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" dependencies = [ - "unicode-xid", + "unicode-ident", ] [[package]] name = "prost" -version = "0.11.0" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "399c3c31cdec40583bb68f0b18403400d01ec4289c383aa047560439952c4dd7" +checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" dependencies = [ "bytes", "prost-derive", @@ -1069,9 +1072,9 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.11.1" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f835c582e6bd972ba8347313300219fed5bfa52caf175298d860b61ff6069bb" +checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270" dependencies = [ "bytes", "heck", @@ -1080,41 +1083,42 @@ dependencies = [ "log", "multimap", "petgraph", + "prettyplease", "prost", "prost-types", "regex", + "syn 1.0.90", "tempfile", "which", ] [[package]] name = "prost-derive" -version = "0.11.0" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7345d5f0e08c0536d7ac7229952590239e77abf0a0100a1b1d890add6ea96364" +checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" dependencies = [ "anyhow", "itertools", "proc-macro2", "quote", - "syn", + "syn 1.0.90", ] [[package]] name = "prost-types" -version = "0.11.0" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d30bc806a29b347314be074ff0608ef8e547286e8ea68b061a2fe55689edc01f" +checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13" dependencies = [ - "bytes", "prost", ] [[package]] name = "quote" -version = "1.0.17" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "632d02bff7f874a36f33ea8bb416cd484b90cc66c1194b1a1110d067a7013f58" +checksum = "8f4f29d145265ec1c483c7c654450edde0bfe043d3938d6972630663356d9500" dependencies = [ "proc-macro2", ] @@ -1210,6 +1214,12 @@ version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" +[[package]] +name = "rustversion" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06" + [[package]] name = "ryu" version = "1.0.9" @@ -1239,7 +1249,7 @@ checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.90", ] [[package]] @@ -1306,9 +1316,9 @@ checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" [[package]] name = "socket2" -version = "0.4.4" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0" +checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" dependencies = [ "libc", "winapi", @@ -1331,6 +1341,17 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "syn" +version = "2.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "sync_wrapper" version = "0.1.1" @@ -1383,7 +1404,7 @@ checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.90", ] [[package]] @@ -1453,7 +1474,7 @@ dependencies = [ "serde", "tokio", "toml", - "tonic", + "tonic 0.8.3", "tower", "tracing", "tracing-journald", @@ -1479,7 +1500,7 @@ checksum = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.90", ] [[package]] @@ -1518,14 +1539,14 @@ dependencies = [ [[package]] name = "tonic" -version = "0.8.0" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "498f271adc46acce75d66f639e4d35b31b2394c295c82496727dafa16d465dd2" +checksum = "8f219fad3b929bef19b1f86fbc0358d35daed8f2cac972037ac0dc10bbb8d5fb" dependencies = [ "async-stream", "async-trait", "axum", - "base64", + "base64 0.13.0", "bytes", "futures-core", "futures-util", @@ -1548,24 +1569,52 @@ dependencies = [ "tracing-futures", ] +[[package]] +name = "tonic" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3082666a3a6433f7f511c7192923fa1fe07c69332d3c6a2e6bb040b569199d5a" +dependencies = [ + "async-trait", + "axum", + "base64 0.21.0", + "bytes", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-timeout", + "percent-encoding", + "pin-project", + "prost", + "tokio", + "tokio-stream", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + [[package]] name = "tonic-build" -version = "0.8.0" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fbcd2800e34e743b9ae795867d5f77b535d3a3be69fd731e39145719752df8c" +checksum = "a6fdaae4c2c638bb70fe42803a26fbd6fc6ac8c72f5c59f67ecc2a2dcabf4b07" dependencies = [ "prettyplease", "proc-macro2", "prost-build", "quote", - "syn", + "syn 1.0.90", ] [[package]] name = "tower" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a89fd63ad6adf737582df5db40d286574513c69a11dac5214dc3b5603d6713e" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" dependencies = [ "futures-core", "futures-util", @@ -1581,30 +1630,11 @@ dependencies = [ "tracing", ] -[[package]] -name = "tower-http" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aba3f3efabf7fb41fae8534fc20a817013dd1c12cb45441efb6c82e6556b4cd8" -dependencies = [ - "bitflags", - "bytes", - "futures-core", - "futures-util", - "http", - "http-body", - "http-range-header", - "pin-project-lite", - "tower", - "tower-layer", - "tower-service", -] - [[package]] name = "tower-layer" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "343bc9466d3fe6b0f960ef45960509f84480bf4fd96f92901afe7ff3df9d3a62" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" [[package]] name = "tower-service" @@ -1633,7 +1663,7 @@ checksum = "2e65ce065b4b5c53e73bb28912318cb8c9e9ad3921f1d669eb0e68b4c8143a2b" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.90", ] [[package]] @@ -1732,6 +1762,12 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f" +[[package]] +name = "unicode-ident" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" + [[package]] name = "unicode-normalization" version = "0.1.19" diff --git a/console-api/Cargo.toml b/console-api/Cargo.toml index f01d08a08..6062f28e6 100644 --- a/console-api/Cargo.toml +++ b/console-api/Cargo.toml @@ -26,10 +26,10 @@ keywords = [ [features] # Generate code that is compatible with Tonic's `transport` module. -transport = ["tonic-build/transport", "tonic/transport"] +transport = ["tonic/transport"] [dependencies] -tonic = { version = "0.8", default-features = false, features = [ +tonic = { version = "0.9", default-features = false, features = [ "prost", "codegen", "transport", @@ -39,7 +39,7 @@ prost-types = "0.11" tracing-core = "0.1.17" [dev-dependencies] -tonic-build = { version = "0.8", default-features = false, features = [ +tonic-build = { version = "0.9", default-features = false, features = [ "prost", "transport" ] } # explicit dep so we can get the version with fixed whitespace. 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 fb2613540..bbdf909ca 100644 --- a/console-api/src/generated/rs.tokio.console.async_ops.rs +++ b/console-api/src/generated/rs.tokio.console.async_ops.rs @@ -2,16 +2,17 @@ /// /// This includes a list of any new async ops, and updates to the associated statistics /// for any async ops that have changed since the last update. +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct AsyncOpUpdate { /// A list of new async operations that were created since the last `AsyncOpUpdate` /// was sent. Note that the fact that an async operation has been created /// does not mean that is has been polled or is being polled. This information /// is reflected in the `Stats` of the operation. - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub new_async_ops: ::prost::alloc::vec::Vec, /// Any async op stats that have changed since the last update. - #[prost(map="uint64, message", tag="2")] + #[prost(map = "uint64, message", tag = "2")] pub stats_update: ::std::collections::HashMap, /// A count of how many async op events (e.g. polls, creation, etc) were not /// recorded because the application's event buffer was at capacity. @@ -23,7 +24,7 @@ pub struct AsyncOpUpdate { /// /// If the application's instrumentation ensures reliable delivery of events, /// this will always be 0. - #[prost(uint64, tag="3")] + #[prost(uint64, tag = "3")] pub dropped_events: u64, } /// An async operation. @@ -31,24 +32,25 @@ pub struct AsyncOpUpdate { /// An async operation is an operation that is associated with a resource /// This could, for example, be a a read or write on a TCP stream, or a receive operation on /// a channel. +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct AsyncOp { /// The async op's ID. /// /// This uniquely identifies this op across all *currently live* /// ones. - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub id: ::core::option::Option, /// The numeric ID of the op's `Metadata`. /// /// This identifies the `Metadata` that describes the `tracing` span /// corresponding to this async op. The metadata for this ID will have been sent /// in a prior `RegisterMetadata` message. - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub metadata: ::core::option::Option, /// The source of this async operation. Most commonly this should be the name /// of the method where the instantiation of this op has happened. - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub source: ::prost::alloc::string::String, /// The ID of the parent async op. /// @@ -58,28 +60,29 @@ pub struct AsyncOp { /// /// This field can be empty; if it is empty, this async op is not a child of another /// async op. - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub parent_async_op_id: ::core::option::Option, /// The resources's ID. - #[prost(message, optional, tag="5")] + #[prost(message, optional, tag = "5")] pub resource_id: ::core::option::Option, } /// Statistics associated with a given async operation. +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Stats { /// Timestamp of when the async op has been created. - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub created_at: ::core::option::Option<::prost_types::Timestamp>, /// Timestamp of when the async op was dropped. - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub dropped_at: ::core::option::Option<::prost_types::Timestamp>, /// The Id of the task that is awaiting on this op. - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub task_id: ::core::option::Option, /// Contains the operation poll stats. - #[prost(message, optional, tag="5")] + #[prost(message, optional, tag = "5")] pub poll_stats: ::core::option::Option, /// State attributes of the async op. - #[prost(message, repeated, tag="6")] + #[prost(message, repeated, tag = "6")] pub attributes: ::prost::alloc::vec::Vec, } diff --git a/console-api/src/generated/rs.tokio.console.common.rs b/console-api/src/generated/rs.tokio.console.common.rs index 315d7825a..478de279e 100644 --- a/console-api/src/generated/rs.tokio.console.common.rs +++ b/console-api/src/generated/rs.tokio.console.common.rs @@ -1,54 +1,59 @@ /// Unique identifier for each task. +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Id { /// The unique identifier's concrete value. - #[prost(uint64, tag="1")] + #[prost(uint64, tag = "1")] pub id: u64, } /// A Rust source code location. +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Location { /// The file path - #[prost(string, optional, tag="1")] + #[prost(string, optional, tag = "1")] pub file: ::core::option::Option<::prost::alloc::string::String>, /// The Rust module path - #[prost(string, optional, tag="2")] + #[prost(string, optional, tag = "2")] pub module_path: ::core::option::Option<::prost::alloc::string::String>, /// The line number in the source code file. - #[prost(uint32, optional, tag="3")] + #[prost(uint32, optional, tag = "3")] pub line: ::core::option::Option, /// The character in `line`. - #[prost(uint32, optional, tag="4")] + #[prost(uint32, optional, tag = "4")] pub column: ::core::option::Option, } /// Unique identifier for metadata. +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MetaId { /// The unique identifier's concrete value. - #[prost(uint64, tag="1")] + #[prost(uint64, tag = "1")] pub id: u64, } /// Unique identifier for spans. +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct SpanId { /// The unique identifier's concrete value. - #[prost(uint64, tag="1")] + #[prost(uint64, tag = "1")] pub id: u64, } /// A message representing a key-value pair of data associated with a `Span` +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Field { /// Metadata for the task span that the field came from. - #[prost(message, optional, tag="8")] + #[prost(message, optional, tag = "8")] pub metadata_id: ::core::option::Option, /// The key of the key-value pair. /// /// This is either represented as a string, or as an index into a `Metadata`'s /// array of field name strings. - #[prost(oneof="field::Name", tags="1, 2")] + #[prost(oneof = "field::Name", tags = "1, 2")] pub name: ::core::option::Option, /// The value of the key-value pair. - #[prost(oneof="field::Value", tags="3, 4, 5, 6, 7")] + #[prost(oneof = "field::Value", tags = "3, 4, 5, 6, 7")] pub value: ::core::option::Option, } /// Nested message and enum types in `Field`. @@ -57,107 +62,123 @@ pub mod field { /// /// This is either represented as a string, or as an index into a `Metadata`'s /// array of field name strings. + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Name { /// The string representation of the name. - #[prost(string, tag="1")] + #[prost(string, tag = "1")] StrName(::prost::alloc::string::String), /// An index position into the `Metadata.field_names` of the metadata /// for the task span that the field came from. - #[prost(uint64, tag="2")] + #[prost(uint64, tag = "2")] NameIdx(u64), } /// The value of the key-value pair. + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Value { /// A value serialized to a string using `fmt::Debug`. - #[prost(string, tag="3")] + #[prost(string, tag = "3")] DebugVal(::prost::alloc::string::String), /// A string value. - #[prost(string, tag="4")] + #[prost(string, tag = "4")] StrVal(::prost::alloc::string::String), /// An unsigned integer value. - #[prost(uint64, tag="5")] + #[prost(uint64, tag = "5")] U64Val(u64), /// A signed integer value. - #[prost(sint64, tag="6")] + #[prost(sint64, tag = "6")] I64Val(i64), /// A boolean value. - #[prost(bool, tag="7")] + #[prost(bool, tag = "7")] BoolVal(bool), } } /// Represents a period of time in which a program was executing in a particular context. /// /// Corresponds to `Span` in the `tracing` crate. +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Span { /// An Id that uniquely identifies it in relation to other spans. - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub id: ::core::option::Option, /// Identifier for metadata describing static characteristics of all spans originating /// from that callsite, such as its name, source code location, verbosity level, and /// the names of its fields. - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub metadata_id: ::core::option::Option, /// User-defined key-value pairs of arbitrary data that describe the context the span represents, - #[prost(message, repeated, tag="3")] + #[prost(message, repeated, tag = "3")] pub fields: ::prost::alloc::vec::Vec, /// Timestamp for the span. - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub at: ::core::option::Option<::prost_types::Timestamp>, } /// Any new metadata that was registered since the last update. +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct RegisterMetadata { /// The new metadata that was registered since the last update. - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub metadata: ::prost::alloc::vec::Vec, } /// Nested message and enum types in `RegisterMetadata`. pub mod register_metadata { /// One metadata element registered since the last update. + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct NewMetadata { /// Unique identifier for `metadata`. - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub id: ::core::option::Option, /// The metadata payload. - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub metadata: ::core::option::Option, } } /// Metadata associated with a span or event. +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Metadata { /// The name of the span or event. - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub name: ::prost::alloc::string::String, /// Describes the part of the system where the span or event that this /// metadata describes occurred. - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub target: ::prost::alloc::string::String, /// The path to the Rust module where the span occurred. - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub module_path: ::prost::alloc::string::String, /// The Rust source location associated with the span or event. - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub location: ::core::option::Option, /// Indicates whether metadata is associated with a span or with an event. - #[prost(enumeration="metadata::Kind", tag="5")] + #[prost(enumeration = "metadata::Kind", tag = "5")] pub kind: i32, /// Describes the level of verbosity of a span or event. - #[prost(enumeration="metadata::Level", tag="6")] + #[prost(enumeration = "metadata::Level", tag = "6")] pub level: i32, /// The names of the key-value fields attached to the /// span or event this metadata is associated with. - #[prost(string, repeated, tag="7")] + #[prost(string, repeated, tag = "7")] pub field_names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } /// Nested message and enum types in `Metadata`. pub mod metadata { /// Indicates whether metadata is associated with a span or with an event. - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] #[repr(i32)] pub enum Kind { /// Indicates metadata is associated with a span. @@ -176,11 +197,29 @@ pub mod metadata { Kind::Event => "EVENT", } } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "SPAN" => Some(Self::Span), + "EVENT" => Some(Self::Event), + _ => None, + } + } } /// Describes the level of verbosity of a span or event. /// /// Corresponds to `Level` in the `tracing` crate. - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] #[repr(i32)] pub enum Level { /// The "error" level. @@ -217,15 +256,27 @@ pub mod metadata { Level::Trace => "TRACE", } } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "ERROR" => Some(Self::Error), + "WARN" => Some(Self::Warn), + "INFO" => Some(Self::Info), + "DEBUG" => Some(Self::Debug), + "TRACE" => Some(Self::Trace), + _ => None, + } + } } } /// Contains stats about objects that can be polled. Currently these can be: /// - 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)] pub struct PollStats { /// The total number of times this object has been polled. - #[prost(uint64, tag="1")] + #[prost(uint64, tag = "1")] pub polls: u64, /// The timestamp of the first time this object was polled. /// @@ -233,7 +284,7 @@ pub struct PollStats { /// /// Subtracting this timestamp from `created_at` can be used to calculate the /// time to first poll for this object, a measurement of executor latency. - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub first_poll: ::core::option::Option<::prost_types::Timestamp>, /// The timestamp of the most recent time this objects's poll method was invoked. /// @@ -242,7 +293,7 @@ pub struct PollStats { /// If the object has only been polled a single time, then this value may be /// equal to the `first_poll` timestamp. /// - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub last_poll_started: ::core::option::Option<::prost_types::Timestamp>, /// The timestamp of the most recent time this objects's poll method finished execution. /// @@ -250,7 +301,7 @@ pub struct PollStats { /// /// If the object does not exist anymore, then this is the time the final invocation of /// its poll method has completed. - #[prost(message, optional, tag="5")] + #[prost(message, optional, tag = "5")] pub last_poll_ended: ::core::option::Option<::prost_types::Timestamp>, /// The total duration this object was being *actively polled*, summed across /// all polls. @@ -260,7 +311,7 @@ pub struct PollStats { /// total lifetime of the polled object results in the amount of time it /// has spent *waiting* to be polled (including the `scheduled_time` value /// from `TaskStats`, if this is a task). - #[prost(message, optional, tag="6")] + #[prost(message, optional, tag = "6")] pub busy_time: ::core::option::Option<::prost_types::Duration>, } /// State attributes of an entity. These are dependent on the type of the entity. @@ -270,13 +321,14 @@ pub struct PollStats { /// indicating how many permits they are trying to acquire vs how many are acquired. /// These values may change over time. Therefore, they live in the runtime stats rather /// than the static data describing the entity. +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Attribute { /// The key-value pair for the attribute - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub field: ::core::option::Option, /// Some values carry a unit of measurement. For example, a duration /// carries an associated unit of time, such as "ms" for milliseconds. - #[prost(string, optional, tag="2")] + #[prost(string, optional, tag = "2")] pub unit: ::core::option::Option<::prost::alloc::string::String>, } diff --git a/console-api/src/generated/rs.tokio.console.instrument.rs b/console-api/src/generated/rs.tokio.console.instrument.rs index e39c9331c..bfc9d0f05 100644 --- a/console-api/src/generated/rs.tokio.console.instrument.rs +++ b/console-api/src/generated/rs.tokio.console.instrument.rs @@ -4,25 +4,26 @@ /// TODO: In the future allow for the request to specify /// 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)] -pub struct InstrumentRequest { -} +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)] pub struct TaskDetailsRequest { /// Identifies the task for which details were requested. - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub id: ::core::option::Option, } /// PauseRequest requests the stream of updates to pause. +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct PauseRequest { -} +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)] -pub struct ResumeRequest { -} +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 /// of these into a single message: @@ -31,35 +32,36 @@ pub struct ResumeRequest { /// - we can have all the new_metadata in one place /// - things such as async ops and resource ops do not make sense /// on their own as they have relations to tasks and resources +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Update { /// The system time when this update was recorded. /// /// This is the timestamp any durations in the included `Stats` were /// calculated relative to. - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub now: ::core::option::Option<::prost_types::Timestamp>, /// Task state update. - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub task_update: ::core::option::Option, /// Resource state update. - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub resource_update: ::core::option::Option, /// Async operations state update - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub async_op_update: ::core::option::Option, /// Any new span metadata that was registered since the last update. - #[prost(message, optional, tag="5")] + #[prost(message, optional, tag = "5")] pub new_metadata: ::core::option::Option, } /// `PauseResponse` is the value returned after a pause request. +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct PauseResponse { -} +pub struct PauseResponse {} /// `ResumeResponse` is the value returned after a resume request. +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct ResumeResponse { -} +pub struct ResumeResponse {} /// Generated client implementations. pub mod instrument_client { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] @@ -74,7 +76,7 @@ pub mod instrument_client { /// Attempt to create a new client by connecting to a given endpoint. pub async fn connect(dst: D) -> Result where - D: std::convert::TryInto, + D: TryInto, D::Error: Into, { let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; @@ -130,11 +132,27 @@ pub mod instrument_client { self.inner = self.inner.accept_compressed(encoding); self } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } /// Produces a stream of updates representing the behavior of the instrumented async runtime. pub async fn watch_updates( &mut self, request: impl tonic::IntoRequest, - ) -> Result< + ) -> std::result::Result< tonic::Response>, tonic::Status, > { @@ -151,13 +169,21 @@ pub mod instrument_client { let path = http::uri::PathAndQuery::from_static( "/rs.tokio.console.instrument.Instrument/WatchUpdates", ); - self.inner.server_streaming(request.into_request(), path, codec).await + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "rs.tokio.console.instrument.Instrument", + "WatchUpdates", + ), + ); + self.inner.server_streaming(req, path, codec).await } /// Produces a stream of updates describing the activity of a specific task. pub async fn watch_task_details( &mut self, request: impl tonic::IntoRequest, - ) -> Result< + ) -> std::result::Result< tonic::Response< tonic::codec::Streaming, >, @@ -176,13 +202,21 @@ pub mod instrument_client { let path = http::uri::PathAndQuery::from_static( "/rs.tokio.console.instrument.Instrument/WatchTaskDetails", ); - self.inner.server_streaming(request.into_request(), path, codec).await + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "rs.tokio.console.instrument.Instrument", + "WatchTaskDetails", + ), + ); + self.inner.server_streaming(req, path, codec).await } /// Registers that the console observer wants to pause the stream. pub async fn pause( &mut self, request: impl tonic::IntoRequest, - ) -> Result, tonic::Status> { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await @@ -196,13 +230,18 @@ pub mod instrument_client { let path = http::uri::PathAndQuery::from_static( "/rs.tokio.console.instrument.Instrument/Pause", ); - self.inner.unary(request.into_request(), path, codec).await + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("rs.tokio.console.instrument.Instrument", "Pause"), + ); + self.inner.unary(req, path, codec).await } /// Registers that the console observer wants to resume the stream. pub async fn resume( &mut self, request: impl tonic::IntoRequest, - ) -> Result, tonic::Status> { + ) -> std::result::Result, tonic::Status> { self.inner .ready() .await @@ -216,7 +255,12 @@ pub mod instrument_client { let path = http::uri::PathAndQuery::from_static( "/rs.tokio.console.instrument.Instrument/Resume", ); - self.inner.unary(request.into_request(), path, codec).await + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("rs.tokio.console.instrument.Instrument", "Resume"), + ); + self.inner.unary(req, path, codec).await } } } @@ -224,12 +268,12 @@ pub mod instrument_client { pub mod instrument_server { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; - ///Generated trait containing gRPC methods that should be implemented for use with InstrumentServer. + /// Generated trait containing gRPC methods that should be implemented for use with InstrumentServer. #[async_trait] pub trait Instrument: Send + Sync + 'static { - ///Server streaming response type for the WatchUpdates method. + /// Server streaming response type for the WatchUpdates method. type WatchUpdatesStream: futures_core::Stream< - Item = Result, + Item = std::result::Result, > + Send + 'static; @@ -237,10 +281,16 @@ pub mod instrument_server { async fn watch_updates( &self, request: tonic::Request, - ) -> Result, tonic::Status>; - ///Server streaming response type for the WatchTaskDetails method. + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Server streaming response type for the WatchTaskDetails method. type WatchTaskDetailsStream: futures_core::Stream< - Item = Result, + Item = std::result::Result< + super::super::tasks::TaskDetails, + tonic::Status, + >, > + Send + 'static; @@ -248,17 +298,20 @@ pub mod instrument_server { async fn watch_task_details( &self, request: tonic::Request, - ) -> Result, tonic::Status>; + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; /// Registers that the console observer wants to pause the stream. async fn pause( &self, request: tonic::Request, - ) -> Result, tonic::Status>; + ) -> std::result::Result, tonic::Status>; /// Registers that the console observer wants to resume the stream. async fn resume( &self, request: tonic::Request, - ) -> Result, tonic::Status>; + ) -> std::result::Result, tonic::Status>; } /// `InstrumentServer` implements `Instrument` as a service. #[derive(Debug)] @@ -266,6 +319,8 @@ pub mod instrument_server { inner: _Inner, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, } struct _Inner(Arc); impl InstrumentServer { @@ -278,6 +333,8 @@ pub mod instrument_server { inner, accept_compression_encodings: Default::default(), send_compression_encodings: Default::default(), + max_decoding_message_size: None, + max_encoding_message_size: None, } } pub fn with_interceptor( @@ -301,6 +358,22 @@ pub mod instrument_server { self.send_compression_encodings.enable(encoding); self } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + self + } } impl tonic::codegen::Service> for InstrumentServer where @@ -314,7 +387,7 @@ pub mod instrument_server { fn poll_ready( &mut self, _cx: &mut Context<'_>, - ) -> Poll> { + ) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { @@ -337,7 +410,7 @@ pub mod instrument_server { &mut self, request: tonic::Request, ) -> Self::Future { - let inner = self.0.clone(); + let inner = Arc::clone(&self.0); let fut = async move { (*inner).watch_updates(request).await }; @@ -346,6 +419,8 @@ pub mod instrument_server { } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; @@ -355,6 +430,10 @@ pub mod instrument_server { .apply_compression_config( accept_compression_encodings, send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, ); let res = grpc.server_streaming(method, req).await; Ok(res) @@ -378,7 +457,7 @@ pub mod instrument_server { &mut self, request: tonic::Request, ) -> Self::Future { - let inner = self.0.clone(); + let inner = Arc::clone(&self.0); let fut = async move { (*inner).watch_task_details(request).await }; @@ -387,6 +466,8 @@ pub mod instrument_server { } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; @@ -396,6 +477,10 @@ pub mod instrument_server { .apply_compression_config( accept_compression_encodings, send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, ); let res = grpc.server_streaming(method, req).await; Ok(res) @@ -416,13 +501,15 @@ pub mod instrument_server { &mut self, request: tonic::Request, ) -> Self::Future { - let inner = self.0.clone(); + let inner = Arc::clone(&self.0); let fut = async move { (*inner).pause(request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; @@ -432,6 +519,10 @@ pub mod instrument_server { .apply_compression_config( accept_compression_encodings, send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) @@ -452,13 +543,15 @@ pub mod instrument_server { &mut self, request: tonic::Request, ) -> Self::Future { - let inner = self.0.clone(); + let inner = Arc::clone(&self.0); let fut = async move { (*inner).resume(request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; @@ -468,6 +561,10 @@ pub mod instrument_server { .apply_compression_config( accept_compression_encodings, send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) @@ -496,12 +593,14 @@ pub mod instrument_server { inner, accept_compression_encodings: self.accept_compression_encodings, send_compression_encodings: self.send_compression_encodings, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, } } } impl Clone for _Inner { fn clone(&self) -> Self { - Self(self.0.clone()) + Self(Arc::clone(&self.0)) } } impl std::fmt::Debug for _Inner { diff --git a/console-api/src/generated/rs.tokio.console.resources.rs b/console-api/src/generated/rs.tokio.console.resources.rs index 714391461..2ee3ba497 100644 --- a/console-api/src/generated/rs.tokio.console.resources.rs +++ b/console-api/src/generated/rs.tokio.console.resources.rs @@ -5,17 +5,18 @@ /// - any new resources that were created since the last update /// - the current stats for any resource whose stats changed since the last update /// - any new poll ops that have been invoked on a resource +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ResourceUpdate { /// A list of new resources that were created since the last `ResourceUpdate` was /// sent. - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub new_resources: ::prost::alloc::vec::Vec, /// Any resource stats that have changed since the last update. - #[prost(map="uint64, message", tag="2")] + #[prost(map = "uint64, message", tag = "2")] pub stats_update: ::std::collections::HashMap, /// A list of all new poll ops that have been invoked on resources since the last update. - #[prost(message, repeated, tag="3")] + #[prost(message, repeated, tag = "3")] pub new_poll_ops: ::prost::alloc::vec::Vec, /// A count of how many resource events (e.g. polls, creation, etc) were not /// recorded because the application's event buffer was at capacity. @@ -27,10 +28,11 @@ pub struct ResourceUpdate { /// /// If the application's instrumentation ensures reliable delivery of events, /// this will always be 0. - #[prost(uint64, tag="4")] + #[prost(uint64, tag = "4")] pub dropped_events: u64, } /// Static data recorded when a new resource is created. +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Resource { /// The resources's ID. @@ -38,43 +40,54 @@ pub struct Resource { /// This uniquely identifies this resource across all *currently live* /// resources. This is also the primary way any operations on a resource /// are associated with it - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub id: ::core::option::Option, /// The numeric ID of the resources's `Metadata`. - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub metadata: ::core::option::Option, /// The resources's concrete rust type. - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub concrete_type: ::prost::alloc::string::String, /// The kind of resource (e.g timer, mutex) - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub kind: ::core::option::Option, /// The location in code where the resource was created. - #[prost(message, optional, tag="5")] + #[prost(message, optional, tag = "5")] pub location: ::core::option::Option, /// The ID of the parent resource. - #[prost(message, optional, tag="6")] + #[prost(message, optional, tag = "6")] pub parent_resource_id: ::core::option::Option, /// Is the resource an internal component of another resource? /// /// For example, a `tokio::time::Interval` resource might contain a /// `tokio::time::Sleep` resource internally. - #[prost(bool, tag="7")] + #[prost(bool, tag = "7")] pub is_internal: bool, } /// Nested message and enum types in `Resource`. pub mod resource { /// The kind of resource (e.g. timer, mutex). + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Kind { /// Every resource is either a known kind or an other (unknown) kind. - #[prost(oneof="kind::Kind", tags="1, 2")] + #[prost(oneof = "kind::Kind", tags = "1, 2")] pub kind: ::core::option::Option, } /// Nested message and enum types in `Kind`. pub mod kind { /// `Known` collects the kinds of resources that are known in this version of the API. - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] #[repr(i32)] pub enum Known { /// `TIMER` signals that this is a timer resource, e.g. waiting for a sleep to finish. @@ -90,38 +103,48 @@ pub mod resource { Known::Timer => "TIMER", } } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "TIMER" => Some(Self::Timer), + _ => None, + } + } } /// Every resource is either a known kind or an other (unknown) kind. + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Kind { /// `known` signals that this kind of resource is known to the console API. - #[prost(enumeration="Known", tag="1")] + #[prost(enumeration = "Known", tag = "1")] Known(i32), /// `other` signals that this kind of resource is unknown to the console API. - #[prost(string, tag="2")] + #[prost(string, tag = "2")] Other(::prost::alloc::string::String), } } } /// Task runtime stats of a resource. +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Stats { /// Timestamp of when the resource was created. - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub created_at: ::core::option::Option<::prost_types::Timestamp>, /// Timestamp of when the resource was dropped. - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub dropped_at: ::core::option::Option<::prost_types::Timestamp>, /// State attributes of the resource. These are dependent on the type of the resource. /// For example, a timer resource will have a duration while a semaphore resource may /// have permits as an attribute. These values may change over time as the state of /// the resource changes. Therefore, they live in the runtime stats rather than the /// static data describing the resource. - #[prost(message, repeated, tag="3")] + #[prost(message, repeated, tag = "3")] pub attributes: ::prost::alloc::vec::Vec, } /// A `PollOp` describes each poll operation that completes within the async /// application. +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct PollOp { /// The numeric ID of the op's `Metadata`. @@ -129,21 +152,21 @@ pub struct PollOp { /// This identifies the `Metadata` that describes the `tracing` span /// corresponding to this op. The metadata for this ID will have been sent /// in a prior `RegisterMetadata` message. - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub metadata: ::core::option::Option, /// The resources's ID. - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub resource_id: ::core::option::Option, /// the name of this op (e.g. poll_elapsed, new_timeout, reset, etc.) - #[prost(string, tag="4")] + #[prost(string, tag = "4")] pub name: ::prost::alloc::string::String, /// Identifies the task context that this poll op has been called from. - #[prost(message, optional, tag="5")] + #[prost(message, optional, tag = "5")] pub task_id: ::core::option::Option, /// Identifies the async op ID that this poll op is part of. - #[prost(message, optional, tag="6")] + #[prost(message, optional, tag = "6")] pub async_op_id: ::core::option::Option, /// Whether this poll op has returned with ready or pending. - #[prost(bool, tag="7")] + #[prost(bool, tag = "7")] pub is_ready: bool, } diff --git a/console-api/src/generated/rs.tokio.console.tasks.rs b/console-api/src/generated/rs.tokio.console.tasks.rs index 47da6dfef..be5ac1b1a 100644 --- a/console-api/src/generated/rs.tokio.console.tasks.rs +++ b/console-api/src/generated/rs.tokio.console.tasks.rs @@ -4,13 +4,14 @@ /// update. This includes: /// - any new tasks that were spawned since the last update /// - the current stats for any task whose stats changed since the last update +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct TaskUpdate { /// A list of new tasks that were spawned since the last `TaskUpdate` was /// sent. /// /// If this is empty, no new tasks were spawned. - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub new_tasks: ::prost::alloc::vec::Vec, /// Any task stats that have changed since the last update. /// @@ -19,7 +20,7 @@ pub struct TaskUpdate { /// since the last `TaskUpdate` in which they were present. If a task's ID /// *is* included in this map, the corresponding value represents a complete /// snapshot of that task's stats at in the current time window. - #[prost(map="uint64, message", tag="3")] + #[prost(map = "uint64, message", tag = "3")] pub stats_update: ::std::collections::HashMap, /// A count of how many task events (e.g. polls, spawns, etc) were not /// recorded because the application's event buffer was at capacity. @@ -31,23 +32,24 @@ pub struct TaskUpdate { /// /// If the application's instrumentation ensures reliable delivery of events, /// this will always be 0. - #[prost(uint64, tag="4")] + #[prost(uint64, tag = "4")] pub dropped_events: u64, } /// A task details update +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct TaskDetails { /// The task's ID which the details belong to. - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub task_id: ::core::option::Option, /// The timestamp for when the update to the task took place. - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub now: ::core::option::Option<::prost_types::Timestamp>, /// A histogram of task scheduled durations. /// /// The scheduled duration is the time a task spends between being /// woken and when it is next polled. - #[prost(message, optional, tag="5")] + #[prost(message, optional, tag = "5")] pub scheduled_times_histogram: ::core::option::Option, /// A histogram of task poll durations. /// @@ -55,7 +57,7 @@ pub struct TaskDetails { /// - the raw binary representation of a HdrHistogram.rs `Histogram` /// serialized to binary in the V2 format (legacy) /// - a binary histogram plus details on outliers (current) - #[prost(oneof="task_details::PollTimesHistogram", tags="3, 4")] + #[prost(oneof = "task_details::PollTimesHistogram", tags = "3, 4")] pub poll_times_histogram: ::core::option::Option, } /// Nested message and enum types in `TaskDetails`. @@ -66,17 +68,19 @@ pub mod task_details { /// - the raw binary representation of a HdrHistogram.rs `Histogram` /// serialized to binary in the V2 format (legacy) /// - a binary histogram plus details on outliers (current) + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum PollTimesHistogram { /// HdrHistogram.rs `Histogram` serialized to binary in the V2 format - #[prost(bytes, tag="3")] + #[prost(bytes, tag = "3")] LegacyHistogram(::prost::alloc::vec::Vec), /// A histogram plus additional data. - #[prost(message, tag="4")] + #[prost(message, tag = "4")] Histogram(super::DurationHistogram), } } /// Data recorded when a new task is spawned. +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Task { /// The task's ID. @@ -86,20 +90,20 @@ pub struct Task { /// identified by this ID; if the client requires additional information /// included in the `Task` message, it should store that data and access it /// by ID. - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub id: ::core::option::Option, /// The numeric ID of the task's `Metadata`. /// /// This identifies the `Metadata` that describes the `tracing` span /// corresponding to this task. The metadata for this ID will have been sent /// in a prior `RegisterMetadata` message. - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub metadata: ::core::option::Option, /// The category of task this task belongs to. - #[prost(enumeration="task::Kind", tag="3")] + #[prost(enumeration = "task::Kind", tag = "3")] pub kind: i32, /// A list of `Field` objects attached to this task. - #[prost(message, repeated, tag="4")] + #[prost(message, repeated, tag = "4")] pub fields: ::prost::alloc::vec::Vec, /// An ordered list of span IDs corresponding to the `tracing` span context /// in which this task was spawned. @@ -112,16 +116,26 @@ pub struct Task { /// /// These IDs may correspond to `tracing` spans which are *not* tasks, if /// additional trace data is being collected. - #[prost(message, repeated, tag="5")] + #[prost(message, repeated, tag = "5")] pub parents: ::prost::alloc::vec::Vec, /// The location in code where the task was spawned. - #[prost(message, optional, tag="6")] + #[prost(message, optional, tag = "6")] pub location: ::core::option::Option, } /// Nested message and enum types in `Task`. pub mod task { /// The category of task this task belongs to. - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] #[repr(i32)] pub enum Kind { /// A task spawned using a runtime's standard asynchronous task spawning @@ -142,36 +156,45 @@ pub mod task { Kind::Blocking => "BLOCKING", } } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "SPAWN" => Some(Self::Spawn), + "BLOCKING" => Some(Self::Blocking), + _ => None, + } + } } } /// Task performance statistics. +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Stats { /// Timestamp of when the task was spawned. - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub created_at: ::core::option::Option<::prost_types::Timestamp>, /// Timestamp of when the task was dropped. - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub dropped_at: ::core::option::Option<::prost_types::Timestamp>, /// The total number of times this task has been woken over its lifetime. - #[prost(uint64, tag="3")] + #[prost(uint64, tag = "3")] pub wakes: u64, /// The total number of times this task's waker has been cloned. - #[prost(uint64, tag="4")] + #[prost(uint64, tag = "4")] pub waker_clones: u64, /// The total number of times this task's waker has been dropped. - #[prost(uint64, tag="5")] + #[prost(uint64, tag = "5")] pub waker_drops: u64, /// The timestamp of the most recent time this task has been woken. /// /// If this is `None`, the task has not yet been woken. - #[prost(message, optional, tag="6")] + #[prost(message, optional, tag = "6")] pub last_wake: ::core::option::Option<::prost_types::Timestamp>, /// Contains task poll statistics. - #[prost(message, optional, tag="7")] + #[prost(message, optional, tag = "7")] pub poll_stats: ::core::option::Option, /// The total number of times this task has woken itself. - #[prost(uint64, tag="8")] + #[prost(uint64, tag = "8")] pub self_wakes: u64, /// The total duration this task was scheduled prior to being polled, summed /// across all poll cycles. @@ -182,22 +205,23 @@ pub struct Stats { /// `scheduled_time` from the total lifetime of the task results in the /// amount of time it spent unable to progress because it was waiting on /// some resource. - #[prost(message, optional, tag="9")] + #[prost(message, optional, tag = "9")] pub scheduled_time: ::core::option::Option<::prost_types::Duration>, } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DurationHistogram { /// HdrHistogram.rs `Histogram` serialized to binary in the V2 format - #[prost(bytes="vec", tag="1")] + #[prost(bytes = "vec", tag = "1")] pub raw_histogram: ::prost::alloc::vec::Vec, /// The histogram's maximum value. - #[prost(uint64, tag="2")] + #[prost(uint64, tag = "2")] pub max_value: u64, /// The number of outliers which have exceeded the histogram's maximum value. - #[prost(uint64, tag="3")] + #[prost(uint64, tag = "3")] pub high_outliers: u64, /// The highest recorded outlier. This is only present if `high_outliers` is /// greater than zero. - #[prost(uint64, optional, tag="4")] + #[prost(uint64, optional, tag = "4")] pub highest_outlier: ::core::option::Option, } diff --git a/console-api/src/generated/rs.tokio.console.trace.rs b/console-api/src/generated/rs.tokio.console.trace.rs index 13c2843a5..b15967baf 100644 --- a/console-api/src/generated/rs.tokio.console.trace.rs +++ b/console-api/src/generated/rs.tokio.console.trace.rs @@ -1,82 +1,89 @@ /// Start watching trace events with the provided filter. +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct WatchRequest { /// Specifies which trace events should be streamed. - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub filter: ::prost::alloc::string::String, } /// A trace event +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct TraceEvent { /// A trace event - #[prost(oneof="trace_event::Event", tags="1, 2, 3, 4, 5, 6")] + #[prost(oneof = "trace_event::Event", tags = "1, 2, 3, 4, 5, 6")] pub event: ::core::option::Option, } /// Nested message and enum types in `TraceEvent`. pub mod trace_event { /// `RegisterThreads` signals that a new thread was registered. + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct RegisterThreads { /// `names` maps the registered thread id's to their associated name. - #[prost(map="uint64, string", tag="1")] + #[prost(map = "uint64, string", tag = "1")] pub names: ::std::collections::HashMap, } /// `Enter` signals that a span was entered. + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Enter { /// `span_id` identifies the span that was entered. - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub span_id: ::core::option::Option, /// `thread_id` identifies who entered the span. - #[prost(uint64, tag="2")] + #[prost(uint64, tag = "2")] pub thread_id: u64, /// `at` identifies when the span was entered. - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub at: ::core::option::Option<::prost_types::Timestamp>, } /// `Exit` signals that a span was exited. + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Exit { /// `span_id` identifies the span that was exited. - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub span_id: ::core::option::Option, /// `thread_id` identifies who exited the span. - #[prost(uint64, tag="2")] + #[prost(uint64, tag = "2")] pub thread_id: u64, /// `at` identifies when the span was exited. - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub at: ::core::option::Option<::prost_types::Timestamp>, } /// `Close` signals that a span was closed. + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Close { /// `span_id` identifies the span that was closed. - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub span_id: ::core::option::Option, /// `at` identifies when the span was closed. - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub at: ::core::option::Option<::prost_types::Timestamp>, } /// A trace event + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Event { /// A new thread was registered. - #[prost(message, tag="1")] + #[prost(message, tag = "1")] RegisterThread(RegisterThreads), /// A new span metadata was registered. - #[prost(message, tag="2")] + #[prost(message, tag = "2")] RegisterMetadata(super::super::common::RegisterMetadata), /// A span was created. - #[prost(message, tag="3")] + #[prost(message, tag = "3")] NewSpan(super::super::common::Span), /// A span was entered. - #[prost(message, tag="4")] + #[prost(message, tag = "4")] EnterSpan(Enter), /// A span was exited. - #[prost(message, tag="5")] + #[prost(message, tag = "5")] ExitSpan(Exit), /// A span was closed. - #[prost(message, tag="6")] + #[prost(message, tag = "6")] CloseSpan(Close), } } @@ -94,7 +101,7 @@ pub mod trace_client { /// Attempt to create a new client by connecting to a given endpoint. pub async fn connect(dst: D) -> Result where - D: std::convert::TryInto, + D: TryInto, D::Error: Into, { let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; @@ -150,11 +157,27 @@ pub mod trace_client { self.inner = self.inner.accept_compressed(encoding); self } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } /// Produces a stream of trace events for the given filter. pub async fn watch( &mut self, request: impl tonic::IntoRequest, - ) -> Result< + ) -> std::result::Result< tonic::Response>, tonic::Status, > { @@ -171,7 +194,10 @@ pub mod trace_client { let path = http::uri::PathAndQuery::from_static( "/rs.tokio.console.trace.Trace/Watch", ); - self.inner.server_streaming(request.into_request(), path, codec).await + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("rs.tokio.console.trace.Trace", "Watch")); + self.inner.server_streaming(req, path, codec).await } } } @@ -179,12 +205,12 @@ pub mod trace_client { pub mod trace_server { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; - ///Generated trait containing gRPC methods that should be implemented for use with TraceServer. + /// Generated trait containing gRPC methods that should be implemented for use with TraceServer. #[async_trait] pub trait Trace: Send + Sync + 'static { - ///Server streaming response type for the Watch method. + /// Server streaming response type for the Watch method. type WatchStream: futures_core::Stream< - Item = Result, + Item = std::result::Result, > + Send + 'static; @@ -192,7 +218,7 @@ pub mod trace_server { async fn watch( &self, request: tonic::Request, - ) -> Result, tonic::Status>; + ) -> std::result::Result, tonic::Status>; } /// Allows observers to stream trace events for a given `WatchRequest` filter. #[derive(Debug)] @@ -200,6 +226,8 @@ pub mod trace_server { inner: _Inner, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, } struct _Inner(Arc); impl TraceServer { @@ -212,6 +240,8 @@ pub mod trace_server { inner, accept_compression_encodings: Default::default(), send_compression_encodings: Default::default(), + max_decoding_message_size: None, + max_encoding_message_size: None, } } pub fn with_interceptor( @@ -235,6 +265,22 @@ pub mod trace_server { self.send_compression_encodings.enable(encoding); self } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + self + } } impl tonic::codegen::Service> for TraceServer where @@ -248,7 +294,7 @@ pub mod trace_server { fn poll_ready( &mut self, _cx: &mut Context<'_>, - ) -> Poll> { + ) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { @@ -271,13 +317,15 @@ pub mod trace_server { &mut self, request: tonic::Request, ) -> Self::Future { - let inner = self.0.clone(); + let inner = Arc::clone(&self.0); let fut = async move { (*inner).watch(request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let inner = inner.0; @@ -287,6 +335,10 @@ pub mod trace_server { .apply_compression_config( accept_compression_encodings, send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, ); let res = grpc.server_streaming(method, req).await; Ok(res) @@ -315,12 +367,14 @@ pub mod trace_server { inner, accept_compression_encodings: self.accept_compression_encodings, send_compression_encodings: self.send_compression_encodings, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, } } } impl Clone for _Inner { fn clone(&self) -> Self { - Self(self.0.clone()) + Self(Arc::clone(&self.0)) } } impl std::fmt::Debug for _Inner { diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index f113b8128..b7f297a12 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -7,7 +7,7 @@ rust-version = "1.56.0" publish = false [dependencies] -tonic-build = { version = "0.8", default-features = false, features = [ +tonic-build = { version = "0.9", default-features = false, features = [ "prost", "transport" ] } clap = { version = "3", features = ["derive"] } From 3031c9d478ed5b2f3049cf02b6267d6f116296b5 Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Tue, 9 May 2023 09:49:44 -0700 Subject: [PATCH 2/3] feat: update `tonic` to 0.9 (#420) This commit updates the `console-subscriber` and `tokio-console` crates' `tonic` dependencies to 0.9. This is not a breaking change to these crates. --- Cargo.lock | 70 ++--------------------------------- console-subscriber/Cargo.toml | 2 +- tokio-console/Cargo.toml | 2 +- 3 files changed, 5 insertions(+), 69 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ba1dbca64..1356560c2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -41,28 +41,6 @@ version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4361135be9122e0870de935d7c439aef945b9f9ddd4199a553b5270b49c82a27" -[[package]] -name = "async-stream" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" -dependencies = [ - "async-stream-impl", - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "async-stream-impl" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.15", -] - [[package]] name = "async-trait" version = "0.1.68" @@ -282,7 +260,7 @@ dependencies = [ "prost", "prost-build", "prost-types", - "tonic 0.9.2", + "tonic", "tonic-build", "tracing-core", ] @@ -304,7 +282,7 @@ dependencies = [ "thread_local", "tokio", "tokio-stream", - "tonic 0.8.3", + "tonic", "tracing", "tracing-core", "tracing-subscriber", @@ -1474,7 +1452,7 @@ dependencies = [ "serde", "tokio", "toml", - "tonic 0.8.3", + "tonic", "tower", "tracing", "tracing-journald", @@ -1537,38 +1515,6 @@ dependencies = [ "serde", ] -[[package]] -name = "tonic" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f219fad3b929bef19b1f86fbc0358d35daed8f2cac972037ac0dc10bbb8d5fb" -dependencies = [ - "async-stream", - "async-trait", - "axum", - "base64 0.13.0", - "bytes", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "hyper", - "hyper-timeout", - "percent-encoding", - "pin-project", - "prost", - "prost-derive", - "tokio", - "tokio-stream", - "tokio-util", - "tower", - "tower-layer", - "tower-service", - "tracing", - "tracing-futures", -] - [[package]] name = "tonic" version = "0.9.2" @@ -1686,16 +1632,6 @@ dependencies = [ "tracing-subscriber", ] -[[package]] -name = "tracing-futures" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" -dependencies = [ - "pin-project", - "tracing", -] - [[package]] name = "tracing-journald" version = "0.2.4" diff --git a/console-subscriber/Cargo.toml b/console-subscriber/Cargo.toml index 3c044c8d7..f3cfc19e2 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.4.0", path = "../console-api", features = ["transport"] } -tonic = { version = "0.8", features = ["transport"] } +tonic = { version = "0.9", features = ["transport"] } tracing-core = "0.1.24" tracing = "0.1.26" tracing-subscriber = { version = "0.3.11", default-features = false, features = ["fmt", "registry"] } diff --git a/tokio-console/Cargo.toml b/tokio-console/Cargo.toml index a6f0de3f3..d1f120131 100644 --- a/tokio-console/Cargo.toml +++ b/tokio-console/Cargo.toml @@ -31,7 +31,7 @@ atty = "0.2" console-api = { version = "0.4.0", path = "../console-api", features = ["transport"] } clap = { version = "3", features = ["cargo", "derive", "env"] } tokio = { version = "1", features = ["full", "rt-multi-thread"] } -tonic = { version = "0.8", features = ["transport"] } +tonic = { version = "0.9", features = ["transport"] } futures = "0.3" tui = { version = "0.16.0", default-features = false, features = ["crossterm"] } tower = "0.4.12" From 4cabcf1b455c5a594a95055d7972199aafbd1381 Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Tue, 9 May 2023 10:01:08 -0700 Subject: [PATCH 3/3] feat: update MSRV to Rust 1.60.0 This is `tonic` 0.9's MSRV, so we must update our minimum Rust version as well. --- .github/workflows/ci.yaml | 5 ++--- console-api/Cargo.toml | 2 +- console-subscriber/Cargo.toml | 2 +- tokio-console/Cargo.toml | 2 +- xtask/Cargo.toml | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7f321f945..4673daf8c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -55,9 +55,8 @@ jobs: os: [ubuntu-latest, macos-latest, windows-latest] rust: [stable] include: - # Make 1.58 MSRV due to <=1.57 failing to build console-api due to a bug - # with cargo version resolution. - - rust: 1.58.0 + # Make 1.60 MSRV, as it's Tonic 0.9's MSRV. + - rust: 1.60.0 os: ubuntu-latest # 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. diff --git a/console-api/Cargo.toml b/console-api/Cargo.toml index 6062f28e6..1288f5d99 100644 --- a/console-api/Cargo.toml +++ b/console-api/Cargo.toml @@ -3,7 +3,7 @@ name = "console-api" version = "0.4.0" license = "MIT" edition = "2021" -rust-version = "1.58.0" +rust-version = "1.60.0" authors = ["Eliza Weisman ", "Tokio Contributors ",] readme = "README.md" repository = "https://github.com/tokio-rs/console/" diff --git a/console-subscriber/Cargo.toml b/console-subscriber/Cargo.toml index f3cfc19e2..e1f367f8a 100644 --- a/console-subscriber/Cargo.toml +++ b/console-subscriber/Cargo.toml @@ -3,7 +3,7 @@ name = "console-subscriber" version = "0.1.8" license = "MIT" edition = "2021" -rust-version = "1.58.0" +rust-version = "1.60.0" authors = ["Eliza Weisman ", "Tokio Contributors ",] readme = "README.md" repository = "https://github.com/tokio-rs/console/" diff --git a/tokio-console/Cargo.toml b/tokio-console/Cargo.toml index d1f120131..bfd060b65 100644 --- a/tokio-console/Cargo.toml +++ b/tokio-console/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.7" license = "MIT" repository = "https://github.com/tokio-rs/console" edition = "2021" -rust-version = "1.58.0" +rust-version = "1.60.0" authors = ["Eliza Weisman ", "Tokio Contributors ",] readme = "README.md" default-run = "tokio-console" diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index b7f297a12..260861f2e 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -3,7 +3,7 @@ name = "xtask" version = "0.1.0" license = "MIT" edition = "2021" -rust-version = "1.56.0" +rust-version = "1.60.0" publish = false [dependencies]