diff --git a/.cargo/config b/.cargo/config index 16f1e73ac..bb108baaf 100644 --- a/.cargo/config +++ b/.cargo/config @@ -1,2 +1,4 @@ +paths = ["/home/jswrenn/projects/tracing"] + [build] -rustflags = ["--cfg", "tokio_unstable"] \ No newline at end of file +rustflags = ["--cfg", "tokio_unstable"] diff --git a/Cargo.lock b/Cargo.lock index e60e9f144..6659426be 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -37,9 +37,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.56" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4361135be9122e0870de935d7c439aef945b9f9ddd4199a553b5270b49c82a27" +checksum = "508b352bb5c066aac251f6daf6b36eccd03e8a88e8081cd44959ea277a3af9a8" [[package]] name = "async-stream" @@ -64,9 +64,9 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.53" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed6aa3524a2dfcf9fe180c51eae2b58738348d819517ceadf95789c51fff7600" +checksum = "76464446b8bc32758d7e88ee1a804d9914cd9b1cb264c029899680b0be29826f" dependencies = [ "proc-macro2", "quote", @@ -92,9 +92,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "axum" -version = "0.5.0" +version = "0.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5611d4977882c5af1c0f7a34d51b5d87f784f86912bb543986b014ea4995ef93" +checksum = "9de18bc5f2e9df8f52da03856bf40e29b747de5a84e43aefff90e3dc4a21529b" dependencies = [ "async-trait", "axum-core", @@ -121,9 +121,9 @@ dependencies = [ [[package]] name = "axum-core" -version = "0.2.0" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95cd109b3e93c9541dcce5b0219dcf89169dcc58c1bebed65082808324258afb" +checksum = "e4f44a0e6200e9d11a1cdc989e4b358f6e3d354fbf48478f345a17f4e43f8635" dependencies = [ "async-trait", "bytes", @@ -135,9 +135,9 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.64" +version = "0.3.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e121dee8023ce33ab248d9ce1493df03c3b38a659b240096fcbd7048ff9c31f" +checksum = "cab84319d616cfb654d03394f38ab7e6f0919e181b1b57e1fd15e7fb4077d9a7" dependencies = [ "addr2line", "cc", @@ -160,6 +160,12 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bumpalo" +version = "3.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3" + [[package]] name = "byteorder" version = "1.4.3" @@ -168,9 +174,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.1.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" +checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" [[package]] name = "cassowary" @@ -192,16 +198,16 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "3.1.8" +version = "3.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71c47df61d9e16dc010b55dba1952a57d8c215dbb533fd13cdd13369aac73b1c" +checksum = "29e724a68d9319343bb3328c9cc2dfde263f4b3142ee1059a9980580171c954b" dependencies = [ "atty", "bitflags", "clap_derive", + "clap_lex", "indexmap", - "lazy_static", - "os_str_bytes", + "once_cell", "strsim", "termcolor", "textwrap", @@ -209,9 +215,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "3.1.7" +version = "3.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3aab4734e083b809aaf5794e14e756d1c798d2c69c7f7de7a09a2f5214993c1" +checksum = "13547f7012c01ab4a0e8f8967730ada8f9fdf419e8b6c792788f39cf4e46eefa" dependencies = [ "heck", "proc-macro-error", @@ -220,6 +226,15 @@ dependencies = [ "syn", ] +[[package]] +name = "clap_lex" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" +dependencies = [ + "os_str_bytes", +] + [[package]] name = "cmake" version = "0.1.48" @@ -278,6 +293,7 @@ dependencies = [ "futures", "hdrhistogram", "humantime", + "once_cell", "parking_lot 0.11.2", "prost-types", "serde", @@ -287,8 +303,9 @@ dependencies = [ "tokio-stream", "tonic", "tracing", + "tracing-causality 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "tracing-core", - "tracing-subscriber 0.3.11", + "tracing-subscriber 0.3.15", ] [[package]] @@ -302,9 +319,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.4" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aaa7bd5fb665c6864b5f963dd9097905c54125909c7aa94c9e18507cdbe6c53" +checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" dependencies = [ "cfg-if", "crossbeam-utils", @@ -312,12 +329,12 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.8" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38" +checksum = "51887d4adc7b564537b15adcfb307936f8075dfcd5f00dde9a9f1d29383682bc" dependencies = [ "cfg-if", - "lazy_static", + "once_cell", ] [[package]] @@ -368,15 +385,15 @@ dependencies = [ [[package]] name = "either" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +checksum = "3f107b87b6afc2a64fd13cac55fe06d6c8859f12d4b14cbcdd2c67d0976781be" [[package]] name = "eyre" -version = "0.6.7" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9289ed2c0440a6536e65119725cf91fc2c6b5e513bfd2e36e1134d7cca6ca12f" +checksum = "4c2b6b5a29c02cdc822728b7d7b8ae1bab3e3b05d44522770ddd49722eeac7eb" dependencies = [ "indenter", "once_cell", @@ -384,31 +401,42 @@ dependencies = [ [[package]] name = "fastrand" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" +checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" dependencies = [ "instant", ] [[package]] name = "fixedbitset" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "279fb028e20b3c4c320317955b77c5e0c9701f05a1d309905d6fc702cdc5053e" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flate2" -version = "1.0.22" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e6988e897c1c9c485f43b47a529cef42fde0547f9d8d41a7062518f1d8fc53f" +checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" dependencies = [ - "cfg-if", "crc32fast", - "libc", "miniz_oxide", ] +[[package]] +name = "flume" +version = "0.10.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577" +dependencies = [ + "futures-core", + "futures-sink", + "nanorand", + "pin-project", + "spin", +] + [[package]] name = "fnv" version = "1.0.7" @@ -427,9 +455,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f73fe65f54d1e12b726f517d3e2135ca3125a437b6d998caf1962961f7172d9e" +checksum = "ab30e97ab6aacfe635fad58f22c2bb06c8b685f7421eb1e064a729e2a5f481fa" dependencies = [ "futures-channel", "futures-core", @@ -442,9 +470,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3083ce4b914124575708913bca19bfe887522d6e2e6d0952943f5eac4a74010" +checksum = "2bfc52cbddcfd745bf1740338492bb0bd83d76c67b445f91c5fb29fae29ecaa1" dependencies = [ "futures-core", "futures-sink", @@ -452,15 +480,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3" +checksum = "d2acedae88d38235936c3922476b10fced7b2b68136f5e3c03c2d5be348a1115" [[package]] name = "futures-executor" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9420b90cfa29e327d0429f19be13e7ddb68fa1cccb09d65e5706b8c7a749b8a6" +checksum = "1d11aa21b5b587a64682c0094c2bdd4df0076c5324961a40cc3abd7f37930528" dependencies = [ "futures-core", "futures-task", @@ -469,15 +497,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc4045962a5a5e935ee2fdedaa4e08284547402885ab326734432bed5d12966b" +checksum = "93a66fc6d035a26a3ae255a6d2bca35eda63ae4c5512bef54449113f7a1228e5" [[package]] name = "futures-macro" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c1e13800337f4d4d7a316bf45a567dbcb6ffe087f16424852d97e97a91f512" +checksum = "0db9cce532b0eae2ccf2766ab246f114b56b9cf6d445e00c2549fbc100ca045d" dependencies = [ "proc-macro2", "quote", @@ -486,21 +514,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21163e139fa306126e6eedaf49ecdb4588f939600f0b1e770f4205ee4b7fa868" +checksum = "ca0bae1fe9752cf7fd9b0064c674ae63f97b37bc714d745cbde0afb7ec4e6765" [[package]] name = "futures-task" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a" +checksum = "842fc63b931f4056a24d59de13fb1272134ce261816e063e634ad0c15cdc5306" [[package]] name = "futures-util" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a" +checksum = "f0828a5471e340229c11c77ca80017937ce3c58cb788a17e5f1c2d5c485a9577" dependencies = [ "futures-channel", "futures-core", @@ -516,20 +544,22 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" +checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" dependencies = [ "cfg-if", + "js-sys", "libc", - "wasi 0.10.2+wasi-snapshot-preview1", + "wasi", + "wasm-bindgen", ] [[package]] name = "gimli" -version = "0.26.1" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" +checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" [[package]] name = "h2" @@ -552,15 +582,15 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.11.2" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hdrhistogram" -version = "7.5.0" +version = "7.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31672b7011be2c4f7456c4ddbcb40e7e9a4a9fad8efe49a6ebaf5f307d0109c0" +checksum = "6ea9fe3952d32674a14e0975009a3547af9ea364995b5ec1add2e23c2ae523ab" dependencies = [ "base64", "byteorder", @@ -586,9 +616,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.6" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f4c6746584866f0feabcc69893c5b51beef3831656a968ed7ae254cdc4fd03" +checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" dependencies = [ "bytes", "fnv", @@ -597,9 +627,9 @@ 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", @@ -614,9 +644,9 @@ checksum = "0bfe8eed0a9285ef776bb792479ea3834e8b94e13d615c2f66d03dd50a435a29" [[package]] name = "httparse" -version = "1.6.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9100414882e15fb7feccb4897e5f0ff0ff1ca7d1a86a23208ada4d7a18e6c6c4" +checksum = "496ce29bb5a52785b44e0f7ca2847ae0bb839c9bd28f69acac9b99d461c0c04c" [[package]] name = "httpdate" @@ -632,9 +662,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.18" +version = "0.14.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b26ae0a80afebe130861d90abf98e3814a4f28a4c6ffeb5ab8ebb2be311e0ef2" +checksum = "02c929dc5c39e335a03c405292728118860721b10190d98c2a0f0efd5baafbac" dependencies = [ "bytes", "futures-channel", @@ -685,9 +715,9 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" [[package]] name = "indexmap" -version = "1.8.1" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f647032dfaa1f8b6dc29bd3edb7bbef4861b8b8007ebb118d6db284fd59f6ee" +checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" dependencies = [ "autocfg", "hashbrown", @@ -713,9 +743,18 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.1" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" +checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754" + +[[package]] +name = "js-sys" +version = "0.3.59" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "258451ab10b34f8af53416d1fdab72c22e805f0c92a1136d59470ec0b11138b2" +dependencies = [ + "wasm-bindgen", +] [[package]] name = "lazy_static" @@ -725,9 +764,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.121" +version = "0.2.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f" +checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5" [[package]] name = "lock_api" @@ -741,9 +780,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.16" +version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6389c490849ff5bc16be905ae24bc913a9c8892e19b2341dbc175e14c341c2b8" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ "cfg-if", ] @@ -771,9 +810,9 @@ checksum = "73cbba799671b762df5a175adf59ce145165747bb891505c43d09aefbbf38beb" [[package]] name = "memchr" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "mime" @@ -789,12 +828,11 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.4.4" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" +checksum = "6f5c75688da582b8ffc1f1799e9db273f32133c49e048f614d22ec3256773ccc" dependencies = [ "adler", - "autocfg", ] [[package]] @@ -812,16 +850,14 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.2" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52da4364ffb0e4fe33a9841a98a3f3014fb964045ce4f7a45a398243c8d6b0c9" +checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf" dependencies = [ "libc", "log", - "miow", - "ntapi", - "wasi 0.11.0+wasi-snapshot-preview1", - "winapi", + "wasi", + "windows-sys", ] [[package]] @@ -839,6 +875,15 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" +[[package]] +name = "nanorand" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" +dependencies = [ + "getrandom", +] + [[package]] name = "nom" version = "7.1.1" @@ -860,9 +905,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" dependencies = [ "autocfg", ] @@ -879,27 +924,24 @@ dependencies = [ [[package]] name = "object" -version = "0.27.1" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ac1d3f9a1d3616fd9a60c8d74296f22406a238b6a72f5cc1e6f314df4ffbf9" +checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.10.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9" +checksum = "074864da206b4973b84eb91683020dbefd6a8c3f0f38e054d93954e891935e4e" [[package]] name = "os_str_bytes" -version = "6.0.0" +version = "6.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64" -dependencies = [ - "memchr", -] +checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff" [[package]] name = "owo-colors" @@ -920,12 +962,12 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f5ec2493a61ac0506c0f4199f99070cbe83857b0337006a30f3e6719b8ef58" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.2", + "parking_lot_core 0.9.3", ] [[package]] @@ -944,9 +986,9 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "995f667a6c822200b0433ac218e05582f0e2efa1b922a3fd2fbaadc5f87bab37" +checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" dependencies = [ "cfg-if", "libc", @@ -963,9 +1005,9 @@ checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" [[package]] name = "petgraph" -version = "0.6.0" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a13a2fa9d0b63e5f22328828741e523766fff0ee9e779316902290dff3f824f" +checksum = "e6d5014253a1331579ce62aa67443b4a658c5e7dd03d4bc6d302b94474888143" dependencies = [ "fixedbitset", "indexmap", @@ -973,18 +1015,18 @@ 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", @@ -993,9 +1035,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" [[package]] name = "pin-utils" @@ -1011,9 +1053,9 @@ checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" [[package]] name = "prettyplease" -version = "0.1.9" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b83ec2d0af5c5c556257ff52c9f98934e243b9fd39604bfb2a9b75ec2e97f18" +checksum = "697ae720ee02011f439e0701db107ffe2916d83f718342d65d7f8bf7b8a5fee9" dependencies = [ "proc-macro2", "syn", @@ -1045,18 +1087,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.36" +version = "1.0.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" +checksum = "0a2ca2c61bc9f3d74d2886294ab7b9853abd9c1ad903a3ac7815c58989bb7bab" dependencies = [ - "unicode-xid", + "unicode-ident", ] [[package]] name = "prost" -version = "0.10.0" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bd5316aa8f5c82add416dfbc25116b84b748a21153f512917e8143640a71bbd" +checksum = "71adf41db68aa0daaefc69bb30bcd68ded9b9abaad5d1fbb6304c4fb390e083e" dependencies = [ "bytes", "prost-derive", @@ -1064,9 +1106,9 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.10.0" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "328f9f29b82409216decb172d81e936415d21245befa79cd34c3f29d87d1c50b" +checksum = "8ae5a4388762d5815a9fc0dea33c56b021cdc8dde0c55e0c9ca57197254b0cab" dependencies = [ "bytes", "cfg-if", @@ -1086,9 +1128,9 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df35198f0777b75e9ff669737c6da5136b59dba33cf5a010a6d1cc4d56defc6f" +checksum = "7b670f45da57fb8542ebdbb6105a925fe571b67f9e7ed9f47a06a84e72b4e7cc" dependencies = [ "anyhow", "itertools", @@ -1099,9 +1141,9 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "926681c118ae6e512a3ccefd4abbe5521a14f4cc1e207356d4d00c0b7f2006fd" +checksum = "2d0a014229361011dc8e69c8a1ec6c2e8d0f2af7c91e3ea3f5b2170298461e68" dependencies = [ "bytes", "prost", @@ -1109,9 +1151,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.17" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "632d02bff7f874a36f33ea8bb416cd484b90cc66c1194b1a1110d067a7013f58" +checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" dependencies = [ "proc-macro2", ] @@ -1148,9 +1190,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.2.13" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ "bitflags", ] @@ -1168,9 +1210,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.5.5" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286" +checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" dependencies = [ "aho-corasick", "memchr", @@ -1188,9 +1230,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.25" +version = "0.6.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" +checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" [[package]] name = "remove_dir_all" @@ -1209,9 +1251,9 @@ checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" [[package]] name = "ryu" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" +checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" [[package]] name = "scopeguard" @@ -1221,18 +1263,18 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "serde" -version = "1.0.136" +version = "1.0.143" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" +checksum = "53e8e5d5b70924f74ff5c6d64d9a5acd91422117c60f48c4e07855238a254553" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.136" +version = "1.0.143" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9" +checksum = "d3d8e8de557aee63c26b85b947f5e59b690d0454c753f3adeb5cd7835ab88391" dependencies = [ "proc-macro2", "quote", @@ -1241,9 +1283,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.79" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e8d9fa5c3b304765ce1fd9c4c8a3de2c8db365a5b91be52f186efc675681d95" +checksum = "38dd04e3c8279e75b31ef29dbdceebfe5ad89f4d0937213c53f7d49d01b3d5a7" dependencies = [ "itoa", "ryu", @@ -1261,9 +1303,9 @@ dependencies = [ [[package]] name = "signal-hook" -version = "0.3.13" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "647c97df271007dcea485bb74ffdb57f2e683f1306c854f468a0c244badabf2d" +checksum = "a253b5e89e2698464fc26b545c9edceb338e18a89effeeecfea192c3025be29d" dependencies = [ "libc", "signal-hook-registry", @@ -1291,15 +1333,18 @@ dependencies = [ [[package]] name = "slab" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32" +checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +dependencies = [ + "autocfg", +] [[package]] name = "smallvec" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" +checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" [[package]] name = "socket2" @@ -1311,6 +1356,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "spin" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f6002a767bff9e83f8eeecf883ecb8011875a21ae8da43bffb817a57e78cc09" +dependencies = [ + "lock_api", +] + [[package]] name = "strsim" version = "0.10.0" @@ -1319,13 +1373,13 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "syn" -version = "1.0.90" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "704df27628939572cd88d33f171cd6f896f4eaca85252c6e0a72d8d8287ee86f" +checksum = "58dbef6ec655055e20b86b15a8cc6d439cca19b667537ac6a1369572d151ab13" dependencies = [ "proc-macro2", "quote", - "unicode-xid", + "unicode-ident", ] [[package]] @@ -1365,18 +1419,18 @@ checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" [[package]] name = "thiserror" -version = "1.0.30" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417" +checksum = "f5f6586b7f764adc0231f4c79be7b920e766bb2f3e51b3661cdb263828f19994" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.30" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b" +checksum = "12bafc5b54507e0149cdf1b145a5d80ab80a90bcd9275df43d4fff68460f6c21" dependencies = [ "proc-macro2", "quote", @@ -1394,9 +1448,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.5.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" dependencies = [ "tinyvec_macros", ] @@ -1409,17 +1463,18 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.17.0" +version = "1.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2af73ac49756f3f7c01172e34a23e5d0216f6c32333757c2c61feb2bbff5a5ee" +checksum = "7a8325f63a7d4774dd041e363b2409ed1c5cbbd0f867795e661df066b2b0a581" dependencies = [ + "autocfg", "bytes", "libc", "memchr", - "mio 0.8.2", + "mio 0.8.4", "num_cpus", "once_cell", - "parking_lot 0.12.0", + "parking_lot 0.12.1", "pin-project-lite", "signal-hook-registry", "socket2", @@ -1450,8 +1505,9 @@ dependencies = [ "toml", "tonic", "tracing", + "tracing-causality 0.1.0", "tracing-journald", - "tracing-subscriber 0.3.11", + "tracing-subscriber 0.3.15", "tui", ] @@ -1467,9 +1523,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7" +checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" dependencies = [ "proc-macro2", "quote", @@ -1478,9 +1534,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50145484efff8818b5ccd256697f36863f587da82cf8b409c53adf1e840798e3" +checksum = "df54d54117d6fdc4e4fea40fe1e4e566b3505700e148a6827e59b34b0d2600d9" dependencies = [ "futures-core", "pin-project-lite", @@ -1489,9 +1545,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.1" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0edfdeb067411dba2044da6d1cb2df793dd35add7888d73c16e3381ded401764" +checksum = "cc463cd8deddc3770d20f9852143d50bf6094e640b485cb2e189a2099085ff45" dependencies = [ "bytes", "futures-core", @@ -1503,18 +1559,18 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.8" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" +checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" dependencies = [ "serde", ] [[package]] name = "tonic" -version = "0.7.0" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a1a361140b1af3f548e0a5105126b3fc737542f6cd4947b66419c80be07db22" +checksum = "5be9d60db39854b30b835107500cf0aca0b0d14d6e1c3de124217c23a29c2ddb" dependencies = [ "async-stream", "async-trait", @@ -1544,9 +1600,9 @@ dependencies = [ [[package]] name = "tonic-build" -version = "0.7.0" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d17087af5c80e5d5fc8ba9878e60258065a0a757e35efe7a05b7904bece1943" +checksum = "d9263bf4c9bfaae7317c1c2faf7f18491d2fe476f70c414b73bf5d445b00ffa1" dependencies = [ "prettyplease", "proc-macro2", @@ -1557,9 +1613,9 @@ dependencies = [ [[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", @@ -1577,9 +1633,9 @@ dependencies = [ [[package]] name = "tower-http" -version = "0.2.5" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aba3f3efabf7fb41fae8534fc20a817013dd1c12cb45441efb6c82e6556b4cd8" +checksum = "3c530c8675c1dbf98facee631536fa116b5fb6382d7dd6dc1b118d970eafe3ba" dependencies = [ "bitflags", "bytes", @@ -1602,15 +1658,13 @@ checksum = "343bc9466d3fe6b0f960ef45960509f84480bf4fd96f92901afe7ff3df9d3a62" [[package]] name = "tower-service" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a1bdf54a7c28a2bbf701e1d2233f6c77f473486b94bee4f9678da5a148dca7f" +version = "0.1.36" dependencies = [ "cfg-if", "log", @@ -1621,9 +1675,7 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e65ce065b4b5c53e73bb28912318cb8c9e9ad3921f1d669eb0e68b4c8143a2b" +version = "0.1.22" dependencies = [ "proc-macro2", "quote", @@ -1631,12 +1683,34 @@ dependencies = [ ] [[package]] -name = "tracing-core" -version = "0.1.24" +name = "tracing-causality" +version = "0.1.0" +dependencies = [ + "flume", + "futures", + "futures-core", + "tracing-core", + "tracing-subscriber 0.3.15", +] + +[[package]] +name = "tracing-causality" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90442985ee2f57c9e1b548ee72ae842f4a9a20e3f417cc38dbc5dc684d9bb4ee" +checksum = "da68a25493b998f3e06cdcb29930f2df47a55f08aee782d42a953b0c87cbed9d" dependencies = [ - "lazy_static", + "flume", + "futures", + "futures-core", + "tracing-core", + "tracing-subscriber 0.3.15", +] + +[[package]] +name = "tracing-core" +version = "0.1.29" +dependencies = [ + "once_cell", "valuable", ] @@ -1668,17 +1742,15 @@ checksum = "1ba49f4829f4e95702943ec6b2fad8936b369d20fa27036caf01329fb230e460" dependencies = [ "libc", "tracing-core", - "tracing-subscriber 0.3.11", + "tracing-subscriber 0.3.15", ] [[package]] name = "tracing-log" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6923477a48e41c1951f1999ef8bb5a3023eb723ceadafe78ffb65dc366761e3" +version = "0.1.3" dependencies = [ - "lazy_static", "log", + "once_cell", "tracing-core", ] @@ -1695,14 +1767,12 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bc28f93baff38037f64e6f43d34cfa1605f27a49c34e8a04c5e78b0babf2596" +version = "0.3.15" dependencies = [ "ansi_term", - "lazy_static", "matchers", - "parking_lot 0.12.0", + "once_cell", + "parking_lot 0.12.1", "regex", "sharded-slab", "smallvec", @@ -1733,15 +1803,21 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f" +checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" + +[[package]] +name = "unicode-ident" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf" [[package]] name = "unicode-normalization" -version = "0.1.19" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" +checksum = "854cbdc4f7bc6ae19c820d44abdc3277ac3e1b2b93db20a636825d9322fb60e6" dependencies = [ "tinyvec", ] @@ -1758,12 +1834,6 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" -[[package]] -name = "unicode-xid" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" - [[package]] name = "url" version = "2.2.2" @@ -1800,15 +1870,63 @@ dependencies = [ [[package]] name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" +version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" +name = "wasm-bindgen" +version = "0.2.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +checksum = "fc7652e3f6c4706c8d9cd54832c4a4ccb9b5336e2c3bd154d5cccfbf1c1f5f7d" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.82" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "662cd44805586bd52971b9586b1df85cdbbd9112e4ef4d8f41559c334dc6ac3f" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.82" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b260f13d3012071dfb1512849c033b1925038373aea48ced3012c09df952c602" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.82" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5be8e654bdd9b79216c2929ab90721aa82faf65c48cdf08bdc4e7f51357b80da" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.82" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6598dd0bd3c7d51095ff6531a5b23e02acdc81804e30d8f07afb77b7215a140a" [[package]] name = "which" @@ -1854,9 +1972,9 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-sys" -version = "0.34.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5acdd78cb4ba54c0045ac14f62d8f94a03d10047904ae2a40afa1e99d8f70825" +checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" dependencies = [ "windows_aarch64_msvc", "windows_i686_gnu", @@ -1867,30 +1985,30 @@ dependencies = [ [[package]] name = "windows_aarch64_msvc" -version = "0.34.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17cffbe740121affb56fad0fc0e421804adf0ae00891205213b5cecd30db881d" +checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" [[package]] name = "windows_i686_gnu" -version = "0.34.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2564fde759adb79129d9b4f54be42b32c89970c18ebf93124ca8870a498688ed" +checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" [[package]] name = "windows_i686_msvc" -version = "0.34.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cd9d32ba70453522332c14d38814bceeb747d80b3958676007acadd7e166956" +checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" [[package]] name = "windows_x86_64_gnu" -version = "0.34.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfce6deae227ee8d356d19effc141a509cc503dfd1f850622ec4b0f84428e1f4" +checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" [[package]] name = "windows_x86_64_msvc" -version = "0.34.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d19538ccc21819d01deaf88d6a17eae6596a12e9aafdbb97916fb49896d89de9" +checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" diff --git a/Cargo.toml b/Cargo.toml index 0f289d821..17d9e1c92 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,3 +5,8 @@ members = [ "console-api" ] resolver = "2" + +[patch.crates-io] +tracing = { path = '/home/jswrenn/projects/tracing/tracing' } +tracing-core = { path = '/home/jswrenn/projects/tracing/tracing-core' } +tracing-subscriber = { path = '/home/jswrenn/projects/tracing/tracing-subscriber' } \ No newline at end of file diff --git a/console-api/Cargo.toml b/console-api/Cargo.toml index ea594dba7..b6aaa599c 100644 --- a/console-api/Cargo.toml +++ b/console-api/Cargo.toml @@ -36,7 +36,7 @@ tonic = { version = "0.7", default-features = false, features = [ ] } prost = "0.10" prost-types = "0.10" -tracing-core = "0.1.17" +tracing-core = "0.1.29" [dev-dependencies] tonic-build = { version = "0.7", default-features = false, features = [ diff --git a/console-api/proto/common.proto b/console-api/proto/common.proto index 5e4a8ec86..6616debb3 100644 --- a/console-api/proto/common.proto +++ b/console-api/proto/common.proto @@ -197,4 +197,4 @@ message Attribute { // Some values carry a unit of measurement. For example, a duration // carries an associated unit of time, such as "ms" for milliseconds. optional string unit = 2; -} \ No newline at end of file +} diff --git a/console-api/proto/consequences.proto b/console-api/proto/consequences.proto new file mode 100644 index 000000000..d7b11ce78 --- /dev/null +++ b/console-api/proto/consequences.proto @@ -0,0 +1,53 @@ +syntax = "proto3"; + +package rs.tokio.console.consequences; + +import "common.proto"; + +message Causality { + oneof update { + Extant extant = 1; + OpenDirect open_direct = 2; + NewIndirect new_indirect = 3; + CloseDirect close_direct = 4; + CloseIndirect close_indirect = 5; + CloseCyclic close_cyclic = 6; + } +} + +message Span { + common.SpanId span_id = 1; + common.MetaId metadata_id = 2; +} + +message Extant { + Span cause = 1; + repeated Span direct_consequences = 2; + repeated Span indirect_consequences = 3; +} + +message OpenDirect { + Span cause = 1; + Span direct_consequences = 2; +} + +message NewIndirect { + Span cause = 1; + Span indirect_consequences = 3; +} + +message CloseDirect { + Span span = 1; + optional Span direct_cause = 2; +} + +message CloseIndirect { + Span span = 1; + repeated Span indirect_causes = 3; +} + +message CloseCyclic { + Span span = 1; + optional Span direct_cause = 2; + repeated Span indirect_causes = 3; +} \ No newline at end of file diff --git a/console-api/proto/tasks.proto b/console-api/proto/tasks.proto index cb7c0dfb1..fcea8a518 100644 --- a/console-api/proto/tasks.proto +++ b/console-api/proto/tasks.proto @@ -4,6 +4,7 @@ package rs.tokio.console.tasks; import "google/protobuf/timestamp.proto"; import "google/protobuf/duration.proto"; +import "consequences.proto"; import "common.proto"; // A task state update. @@ -49,6 +50,9 @@ message TaskDetails { // HdrHistogram.rs `Histogram` serialized to binary in the V2 format optional bytes poll_times_histogram = 3; + + // What the task is currently busy doing. + repeated consequences.Causality causality = 4; } // Data recorded when a new task is spawned. diff --git a/console-api/src/consequences.rs b/console-api/src/consequences.rs new file mode 100644 index 000000000..d820c4652 --- /dev/null +++ b/console-api/src/consequences.rs @@ -0,0 +1 @@ +include!("generated/rs.tokio.console.consequences.rs"); diff --git a/console-api/src/generated/google.protobuf.rs b/console-api/src/generated/google.protobuf.rs new file mode 100644 index 000000000..e69de29bb diff --git a/console-api/src/generated/rs.tokio.console.consequences.rs b/console-api/src/generated/rs.tokio.console.consequences.rs new file mode 100644 index 000000000..4aea7bdd2 --- /dev/null +++ b/console-api/src/generated/rs.tokio.console.consequences.rs @@ -0,0 +1,76 @@ +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Causality { + #[prost(oneof="causality::Update", tags="1, 2, 3, 4, 5, 6")] + pub update: ::core::option::Option, +} +/// Nested message and enum types in `Causality`. +pub mod causality { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Update { + #[prost(message, tag="1")] + Extant(super::Extant), + #[prost(message, tag="2")] + OpenDirect(super::OpenDirect), + #[prost(message, tag="3")] + NewIndirect(super::NewIndirect), + #[prost(message, tag="4")] + CloseDirect(super::CloseDirect), + #[prost(message, tag="5")] + CloseIndirect(super::CloseIndirect), + #[prost(message, tag="6")] + CloseCyclic(super::CloseCyclic), + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Span { + #[prost(message, optional, tag="1")] + pub span_id: ::core::option::Option, + #[prost(message, optional, tag="2")] + pub metadata_id: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Extant { + #[prost(message, optional, tag="1")] + pub cause: ::core::option::Option, + #[prost(message, repeated, tag="2")] + pub direct_consequences: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="3")] + pub indirect_consequences: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OpenDirect { + #[prost(message, optional, tag="1")] + pub cause: ::core::option::Option, + #[prost(message, optional, tag="2")] + pub direct_consequences: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NewIndirect { + #[prost(message, optional, tag="1")] + pub cause: ::core::option::Option, + #[prost(message, optional, tag="3")] + pub indirect_consequences: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CloseDirect { + #[prost(message, optional, tag="1")] + pub span: ::core::option::Option, + #[prost(message, optional, tag="2")] + pub direct_cause: ::core::option::Option, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CloseIndirect { + #[prost(message, optional, tag="1")] + pub span: ::core::option::Option, + #[prost(message, repeated, tag="3")] + pub indirect_causes: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CloseCyclic { + #[prost(message, optional, tag="1")] + pub span: ::core::option::Option, + #[prost(message, optional, tag="2")] + pub direct_cause: ::core::option::Option, + #[prost(message, repeated, tag="3")] + pub indirect_causes: ::prost::alloc::vec::Vec, +} diff --git a/console-api/src/generated/rs.tokio.console.instrument.rs b/console-api/src/generated/rs.tokio.console.instrument.rs index bf1f570ab..95ab8c641 100644 --- a/console-api/src/generated/rs.tokio.console.instrument.rs +++ b/console-api/src/generated/rs.tokio.console.instrument.rs @@ -84,7 +84,7 @@ pub mod instrument_client { where T: tonic::client::GrpcService, T::Error: Into, - T::ResponseBody: Default + Body + Send + 'static, + T::ResponseBody: Body + Send + 'static, ::Error: Into + Send, { pub fn new(inner: T) -> Self { @@ -97,6 +97,7 @@ pub mod instrument_client { ) -> InstrumentClient> where F: tonic::service::Interceptor, + T::ResponseBody: Default, T: tonic::codegen::Service< http::Request, Response = http::Response< @@ -129,9 +130,9 @@ pub mod instrument_client { &mut self, request: impl tonic::IntoRequest, ) -> Result< - tonic::Response>, - tonic::Status, - > { + tonic::Response>, + tonic::Status, + > { self.inner .ready() .await @@ -152,11 +153,9 @@ pub mod instrument_client { &mut self, request: impl tonic::IntoRequest, ) -> Result< - tonic::Response< - tonic::codec::Streaming, - >, - tonic::Status, - > { + tonic::Response>, + tonic::Status, + > { self.inner .ready() .await diff --git a/console-api/src/generated/rs.tokio.console.tasks.rs b/console-api/src/generated/rs.tokio.console.tasks.rs index 5bc335c44..9a6118603 100644 --- a/console-api/src/generated/rs.tokio.console.tasks.rs +++ b/console-api/src/generated/rs.tokio.console.tasks.rs @@ -46,6 +46,9 @@ pub struct TaskDetails { /// HdrHistogram.rs `Histogram` serialized to binary in the V2 format #[prost(bytes="vec", optional, tag="3")] pub poll_times_histogram: ::core::option::Option<::prost::alloc::vec::Vec>, + /// What the task is currently busy doing. + #[prost(message, repeated, tag="4")] + pub causality: ::prost::alloc::vec::Vec, } /// Data recorded when a new task is spawned. #[derive(Clone, PartialEq, ::prost::Message)] diff --git a/console-api/src/generated/rs.tokio.console.trace.rs b/console-api/src/generated/rs.tokio.console.trace.rs index ed3e98991..cdb44a6dc 100644 --- a/console-api/src/generated/rs.tokio.console.trace.rs +++ b/console-api/src/generated/rs.tokio.console.trace.rs @@ -104,7 +104,7 @@ pub mod trace_client { where T: tonic::client::GrpcService, T::Error: Into, - T::ResponseBody: Default + Body + Send + 'static, + T::ResponseBody: Body + Send + 'static, ::Error: Into + Send, { pub fn new(inner: T) -> Self { @@ -117,6 +117,7 @@ pub mod trace_client { ) -> TraceClient> where F: tonic::service::Interceptor, + T::ResponseBody: Default, T: tonic::codegen::Service< http::Request, Response = http::Response< @@ -149,9 +150,9 @@ pub mod trace_client { &mut self, request: impl tonic::IntoRequest, ) -> Result< - tonic::Response>, - tonic::Status, - > { + tonic::Response>, + tonic::Status, + > { self.inner .ready() .await diff --git a/console-api/src/lib.rs b/console-api/src/lib.rs index ea21d924c..906812bb0 100644 --- a/console-api/src/lib.rs +++ b/console-api/src/lib.rs @@ -4,6 +4,8 @@ pub mod async_ops; /// Represents unique id's and Rust source locations. mod common; +/// Represents updates to the causality tree. +pub mod consequences; /// Represents interactions between the console-subscriber and a console client observing it. pub mod instrument; /// Represents updates to the resources in an async runtime. diff --git a/console-subscriber/Cargo.toml b/console-subscriber/Cargo.toml index e2c9f120f..317797f77 100644 --- a/console-subscriber/Cargo.toml +++ b/console-subscriber/Cargo.toml @@ -30,16 +30,17 @@ parking_lot = ["parking_lot_crate", "tracing-subscriber/parking_lot"] env-filter = ["tracing-subscriber/env-filter"] [dependencies] - +once_cell = "1" crossbeam-utils = "0.8.7" tokio = { version = "^1.15", features = ["sync", "time", "macros", "tracing"] } tokio-stream = "0.1" thread_local = "1.1.3" console-api = { version = "0.2.0", path = "../console-api", features = ["transport"] } tonic = { version = "0.7", features = ["transport"] } -tracing-core = "0.1.24" +tracing-core = "0.1.29" tracing = "0.1.26" tracing-subscriber = { version = "0.3.11", default-features = false, features = ["fmt", "registry"] } +tracing-causality = { version = "0.1.0" } futures = { version = "0.3", default-features = false } hdrhistogram = { version = "7.3.0", default-features = false, features = ["serialization"] } # The parking_lot dependency is renamed, because we want our `parking_lot` @@ -55,6 +56,7 @@ crossbeam-channel = "0.5" [dev-dependencies] tokio = { version = "^1.7", features = ["full", "rt-multi-thread"] } +tracing = "0.1.26" futures = "0.3" [package.metadata.docs.rs] diff --git a/console-subscriber/examples/app.rs b/console-subscriber/examples/app.rs index 065778f62..f45d114f0 100644 --- a/console-subscriber/examples/app.rs +++ b/console-subscriber/examples/app.rs @@ -1,4 +1,4 @@ -use std::time::Duration; +use std::{sync::Arc, time::Duration}; static HELP: &str = r#" Example console-instrumented app @@ -15,7 +15,19 @@ OPTIONS: #[tokio::main] async fn main() -> Result<(), Box> { - console_subscriber::init(); + use tracing_subscriber::prelude::*; + + // initialize an underlying `Registry` + let registry = Arc::new(tracing_subscriber::registry()); + + // spawn the console server in the background, + // returning a `Layer`: + let console_layer = console_subscriber::spawn(registry.clone()); + + // build a `Subscriber` by combining layers with the + // `registry`: + registry.with(console_layer).init(); + // spawn optional extras from CLI args // skip first which is command name for opt in std::env::args().skip(1) { diff --git a/console-subscriber/examples/nested.rs b/console-subscriber/examples/nested.rs new file mode 100644 index 000000000..fc4e8992f --- /dev/null +++ b/console-subscriber/examples/nested.rs @@ -0,0 +1,42 @@ +use tokio::task; + +#[tokio::main] +async fn main() -> Result<(), Box> { + use tracing_subscriber::prelude::*; + + tracing_subscriber::registry() + .with(console_subscriber::spawn()) + .init(); + + task::Builder::default() + .name("main-task") + .spawn(async move { + foo().await; + }) + .await?; + + Ok(()) +} + +#[tracing::instrument] +async fn foo() { + println!("{}", tracing::Span::current().metadata().unwrap().name()); + bar().await +} + +#[tracing::instrument] +async fn bar() { + println!(" {}", tracing::Span::current().metadata().unwrap().name()); + baz().await +} + +#[tracing::instrument] +async fn baz() { + println!( + " {}", + tracing::Span::current().metadata().unwrap().name() + ); + loop { + task::yield_now().await; + } +} diff --git a/console-subscriber/src/aggregator/mod.rs b/console-subscriber/src/aggregator/mod.rs index e87cc3038..9fcd168ea 100644 --- a/console-subscriber/src/aggregator/mod.rs +++ b/console-subscriber/src/aggregator/mod.rs @@ -43,7 +43,8 @@ pub(crate) struct Aggregator { watchers: ShrinkVec>, /// Currently active RPCs streaming task details events, by task ID. - details_watchers: ShrinkMap>>, + details_watchers: + ShrinkMap)>>, /// *All* metadata for task spans and user-defined spans that we care about. /// @@ -320,6 +321,24 @@ impl Aggregator { let (tx, rx) = mpsc::channel(buffer); let subscription = Watch(tx); let now = Some(self.base_time.to_timestamp(Instant::now())); + + let span = id.clone(); + + let maybe_trace = self + .shared + .tracer + .get() + .and_then(|tracer| tracer.trace(&span, buffer)); + + let (initial, updates) = if let Some((trace, updates)) = maybe_trace { + (crate::consequences::trace_into_proto(trace), updates) + } else { + // a trace could not be produced, either because the layer hasn't + // been installed yet as the subscriber yet, or because the span + // is already closed + (vec![], tracing_causality::Updates::default()) + }; + // Send back the stream receiver. // Then send the initial state --- if this fails, the subscription is already dead. if stream_sender.send(rx).is_ok() @@ -327,12 +346,13 @@ impl Aggregator { task_id: Some(id.clone().into()), now, poll_times_histogram: stats.serialize_histogram(), + causality: initial, }) { self.details_watchers .entry(id.clone()) .or_insert_with(Vec::new) - .push(subscription); + .push((updates, subscription)); } } // If the task is not found, drop `stream_sender` which will result in a not found error @@ -368,19 +388,28 @@ impl Aggregator { let stats = &self.task_stats; // Assuming there are much fewer task details subscribers than there are // stats updates, iterate over `details_watchers` and compact the map. - self.details_watchers.retain_and_shrink(|id, watchers| { - if let Some(task_stats) = stats.get(id) { - let details = proto::tasks::TaskDetails { - task_id: Some(id.clone().into()), - now: Some(self.base_time.to_timestamp(Instant::now())), - poll_times_histogram: task_stats.serialize_histogram(), - }; - watchers.retain(|watch| watch.update(&details)); - !watchers.is_empty() - } else { - false - } - }); + self.details_watchers + .retain_and_shrink(|id, updates_and_watchers| { + if let Some(task_stats) = stats.get(id) { + let details = proto::tasks::TaskDetails { + task_id: Some(id.clone().into()), + now: Some(self.base_time.to_timestamp(Instant::now())), + poll_times_histogram: task_stats.serialize_histogram(), + causality: vec![], + }; + updates_and_watchers.retain(|(updates, watch)| { + let updates = crate::consequences::updates_into_proto(updates); + let details = proto::tasks::TaskDetails { + causality: updates, + ..details.clone() + }; + watch.update(&details) + }); + !updates_and_watchers.is_empty() + } else { + false + } + }); } /// Update the current state with data from a single event. diff --git a/console-subscriber/src/builder.rs b/console-subscriber/src/builder.rs index 24f0c869c..d17336171 100644 --- a/console-subscriber/src/builder.rs +++ b/console-subscriber/src/builder.rs @@ -8,7 +8,7 @@ use std::{ use tokio::runtime; use tracing::Subscriber; use tracing_subscriber::{ - filter::{self, FilterFn}, + filter, layer::{Layer, SubscriberExt}, prelude::*, registry::LookupSpan, @@ -318,10 +318,8 @@ impl Builder { .expect("`error` filter should always parse successfully") }); - let console_layer = self.spawn(); - tracing_subscriber::registry() - .with(console_layer) + .with(self.spawn()) .with(tracing_subscriber::fmt::layer().with_filter(fmt_filter)) .init(); } @@ -384,26 +382,11 @@ impl Builder { #[must_use = "a `Layer` must be added to a `tracing::Subscriber` in order to be used"] pub fn spawn(self) -> impl Layer where - S: Subscriber + for<'a> LookupSpan<'a>, + S: Subscriber + for<'s> LookupSpan<'s>, { - fn console_filter(meta: &tracing::Metadata<'_>) -> bool { - // events will have *targets* beginning with "runtime" - if meta.is_event() { - return meta.target().starts_with("runtime") || meta.target().starts_with("tokio"); - } - - // spans will have *names* beginning with "runtime". for backwards - // compatibility with older Tokio versions, enable anything with the `tokio` - // target as well. - meta.name().starts_with("runtime.") || meta.target().starts_with("tokio") - } - let self_trace = self.self_trace; let (layer, server) = self.build(); - let filter = - FilterFn::new(console_filter as for<'r, 's> fn(&'r tracing::Metadata<'s>) -> bool); - let layer = layer.with_filter(filter); thread::Builder::new() .name("console_subscriber".into()) @@ -570,9 +553,9 @@ pub fn init() { #[must_use = "a `Layer` must be added to a `tracing::Subscriber`in order to be used"] pub fn spawn() -> impl Layer where - S: Subscriber + for<'a> LookupSpan<'a>, + S: Subscriber + for<'s> LookupSpan<'s>, { - ConsoleLayer::builder().with_default_env().spawn::() + ConsoleLayer::builder().with_default_env().spawn() } fn duration_from_env(var_name: &str) -> Option { diff --git a/console-subscriber/src/consequences.rs b/console-subscriber/src/consequences.rs new file mode 100644 index 000000000..c242dff6a --- /dev/null +++ b/console-subscriber/src/consequences.rs @@ -0,0 +1,140 @@ +use console_api as proto; +use std::fmt; +use tracing::{Dispatch, Subscriber}; +use tracing_causality as causality; +use tracing_subscriber::registry::LookupSpan; + +pub(crate) struct Tracer { + dispatch: Dispatch, + trace: fn(&Dispatch, &tracing::Id, usize) -> Option<(causality::Trace, causality::Updates)>, +} + +impl fmt::Debug for Tracer { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Tracer") + .field("dispatch", &self.dispatch) + .field("trace", &"fn(){}") + .finish() + } +} + +impl Tracer { + pub(crate) fn from_dispatch(dispatch: &tracing::Dispatch) -> Self + where + S: Subscriber + for<'a> LookupSpan<'a>, + { + fn trace( + dispatch: &tracing::Dispatch, + id: &tracing::Id, + capacity: usize, + ) -> Option<(causality::Trace, causality::Updates)> + where + S: Subscriber + for<'a> LookupSpan<'a>, + { + causality::trace(dispatch.downcast_ref::()?, id, capacity) + } + + let _ = dispatch + .downcast_ref::() + .expect("subscriber should downcast to expected type; this is a bug!"); + + Self { + dispatch: dispatch.clone(), + trace: trace::, + } + } + + pub(crate) fn trace( + &self, + id: &tracing::Id, + update_capacity: usize, + ) -> Option<(causality::Trace, causality::Updates)> { + (self.trace)(&self.dispatch, id, update_capacity) + } +} + +fn into_proto_span(span: causality::Span) -> proto::consequences::Span { + proto::consequences::Span { + span_id: Some(span.id.into()), + metadata_id: Some(span.metadata.into()), + } +} + +pub(crate) fn trace_into_proto(trace: causality::Trace) -> Vec { + trace + .iter() + .map(|(cause, consequences)| { + let update = + proto::consequences::causality::Update::Extant(proto::consequences::Extant { + cause: Some(into_proto_span(cause)), + direct_consequences: consequences.iter_direct().map(into_proto_span).collect(), + indirect_consequences: consequences + .iter_indirect() + .map(into_proto_span) + .collect(), + }); + proto::consequences::Causality { + update: Some(update), + } + }) + .collect() +} + +pub(crate) fn updates_into_proto( + updates: &causality::Updates, +) -> Vec { + updates + .drain() + .map(|update| { + let update = match update { + causality::Update::OpenDirect { cause, consequence } => { + proto::consequences::causality::Update::OpenDirect( + proto::consequences::OpenDirect { + cause: Some(into_proto_span(cause)), + direct_consequences: Some(into_proto_span(consequence)), + }, + ) + } + causality::Update::NewIndirect { cause, consequence } => { + proto::consequences::causality::Update::NewIndirect( + proto::consequences::NewIndirect { + cause: Some(into_proto_span(cause)), + indirect_consequences: Some(into_proto_span(consequence)), + }, + ) + } + causality::Update::CloseDirect { span, direct_cause } => { + proto::consequences::causality::Update::CloseDirect( + proto::consequences::CloseDirect { + span: Some(into_proto_span(span)), + direct_cause: direct_cause.map(into_proto_span), + }, + ) + } + causality::Update::CloseIndirect { + span, + indirect_causes, + } => proto::consequences::causality::Update::CloseIndirect( + proto::consequences::CloseIndirect { + span: Some(into_proto_span(span)), + indirect_causes: indirect_causes.into_iter().map(into_proto_span).collect(), + }, + ), + causality::Update::CloseCyclic { + span, + direct_cause, + indirect_causes, + } => proto::consequences::causality::Update::CloseCyclic( + proto::consequences::CloseCyclic { + span: Some(into_proto_span(span)), + direct_cause: direct_cause.map(into_proto_span), + indirect_causes: indirect_causes.into_iter().map(into_proto_span).collect(), + }, + ), + }; + proto::consequences::Causality { + update: Some(update), + } + }) + .collect() +} diff --git a/console-subscriber/src/lib.rs b/console-subscriber/src/lib.rs index 36a2a4d69..b318fa3d1 100644 --- a/console-subscriber/src/lib.rs +++ b/console-subscriber/src/lib.rs @@ -1,5 +1,6 @@ #![doc = include_str!("../README.md")] use console_api as proto; +use once_cell::sync::OnceCell; use proto::resources::resource; use serde::Serialize; use std::{ @@ -17,7 +18,7 @@ use tokio::sync::{mpsc, oneshot}; use tracing_core::{ span::{self, Id}, subscriber::{self, Subscriber}, - Metadata, + Dispatch, Metadata, }; use tracing_subscriber::{ layer::Context, @@ -29,6 +30,7 @@ mod aggregator; mod attribute; mod builder; mod callsites; +mod consequences; mod record; mod stack; mod stats; @@ -157,6 +159,9 @@ struct Shared { /// A counter of how many resource events were dropped because the event buffer /// was at capacity. dropped_resources: AtomicUsize, + + /// Used to query the consequences of spans. + tracer: OnceCell, } struct Watch(mpsc::Sender>); @@ -228,7 +233,8 @@ struct Tracked {} impl ConsoleLayer { /// Returns a `ConsoleLayer` built with the default settings. /// - /// Note: these defaults do *not* include values provided via the + /// Note: + /// these defaults do *not* include values provided via the /// environment variables specified in [`Builder::with_default_env`]. /// /// See also [`Builder::build`]. @@ -494,6 +500,17 @@ impl Layer for ConsoleLayer where S: Subscriber + for<'a> LookupSpan<'a>, { + fn on_register_dispatch(&self, dispatch: &Dispatch) { + let tracer = consequences::Tracer::from_dispatch::(dispatch); + if let Err(_) = self.shared.tracer.set(tracer) { + // XXX(jswrenn): This layer has seemingly been supplied *multiple* + // subscribers. Is that possible? I guess you can call + // `Layer::with_subscriber` multiple times; what happens if you + // install the resulting `Layered` as a subscriber? Is `Arc`ing a + // `Layered` also a recipe for weirdness? + } + } + fn register_callsite(&self, meta: &'static Metadata<'static>) -> subscriber::Interest { let dropped = match (meta.name(), meta.target()) { ("runtime.spawn", _) | ("task", "tokio::task") => { @@ -532,10 +549,26 @@ where }; self.send_metadata(dropped, Event::Metadata(meta)); - subscriber::Interest::always() + + let is_required = if meta.is_event() { + meta.target().starts_with("runtime") || meta.target().starts_with("tokio") + } else { + // spans will have *names* beginning with "runtime." for backwards + // compatibility with older Tokio versions, enable anything with the `tokio` + // target as well. + meta.name().starts_with("runtime.") || meta.target().starts_with("tokio") + }; + + if is_required { + subscriber::Interest::always() + } else { + subscriber::Interest::sometimes() + } } fn on_new_span(&self, attrs: &span::Attributes<'_>, id: &span::Id, ctx: Context<'_, S>) { + tracing_causality::Layer.on_new_span(attrs, id, ctx.clone()); + let metadata = attrs.metadata(); if self.is_spawn(metadata) { let at = Instant::now(); @@ -835,6 +868,8 @@ where } fn on_close(&self, id: span::Id, cx: Context<'_, S>) { + tracing_causality::Layer.on_close(id.clone(), cx.clone()); + if let Some(span) = cx.span(&id) { let now = Instant::now(); let exts = span.extensions(); @@ -893,7 +928,9 @@ impl Server { /// /// [environment variable]: `Builder::with_default_env` pub const DEFAULT_PORT: u16 = 6669; +} +impl Server { /// Starts the gRPC service with the default gRPC settings. /// /// To configure gRPC server settings before starting the server, use diff --git a/tokio-console/Cargo.toml b/tokio-console/Cargo.toml index 5e460b9db..2e67e9a40 100644 --- a/tokio-console/Cargo.toml +++ b/tokio-console/Cargo.toml @@ -34,6 +34,7 @@ tonic = { version = "0.7", features = ["transport"] } futures = "0.3" tui = { version = "0.16.0", default-features = false, features = ["crossterm"] } tracing = "0.1" +tracing-causality = { path = "../../tracing-causality" } tracing-subscriber = { version = "0.3.0", features = ["env-filter"] } tracing-journald = { version = "0.2", optional = true } prost-types = "0.10" diff --git a/tokio-console/src/state/mod.rs b/tokio-console/src/state/mod.rs index 5ac17ee64..4cb3f73c9 100644 --- a/tokio-console/src/state/mod.rs +++ b/tokio-console/src/state/mod.rs @@ -10,7 +10,7 @@ use std::{ cmp::Ordering, collections::hash_map::{Entry, HashMap}, convert::{TryFrom, TryInto}, - fmt, + fmt::{self, Display}, io::Cursor, rc::Rc, time::{Duration, SystemTime}, @@ -24,12 +24,13 @@ use tui::{ pub mod async_ops; pub mod resources; pub mod tasks; +pub mod trace; pub(crate) type DetailsRef = Rc>>; #[derive(Default, Debug)] pub(crate) struct State { - metas: HashMap, + pub(crate) metas: HashMap, last_updated_at: Option, temporality: Temporality, tasks_state: TasksState, @@ -48,11 +49,21 @@ pub(crate) enum Visibility { #[derive(Debug)] pub(crate) struct Metadata { field_names: Vec, - target: InternedStr, + pub(crate) name: InternedStr, + pub(crate) target: InternedStr, + pub(crate) location: Location, id: u64, //TODO: add more metadata as needed } +#[derive(Debug, Default, Eq, PartialEq)] +pub(crate) struct Location { + file: Option, + module_path: Option, + line: Option, + column: Option, +} + #[derive(Debug, Eq, PartialEq)] pub(crate) struct Field { pub(crate) name: InternedStr, @@ -218,16 +229,41 @@ impl State { pub(crate) fn update_task_details(&mut self, update: proto::tasks::TaskDetails) { if let Some(id) = update.task_id { - let details = Details { - span_id: id.id, - poll_times_histogram: update.poll_times_histogram.and_then(|data| { - hdrhistogram::serialization::Deserializer::new() - .deserialize(&mut Cursor::new(&data)) - .ok() - }), + let span_id = id.id; + let task_id = self.tasks_state.ids.id_for(span_id); + let task_ref = self.tasks_state.task(task_id).unwrap(); + let task_ref = task_ref.upgrade().unwrap(); + let meta_id = task_ref.borrow().meta_id(); + let poll_times_histogram = update.poll_times_histogram.and_then(|data| { + hdrhistogram::serialization::Deserializer::new() + .deserialize(&mut Cursor::new(&data)) + .ok() + }); + let details = self.current_task_details.take(); + let mut fresh = Details { + span_id, + poll_times_histogram, + causality: details.and_then(|details| details.causality), }; - *self.current_task_details.borrow_mut() = Some(details); + if let None = fresh.causality { + fresh.causality = Some(tracing_causality::Trace::with_root( + tracing_causality::Span { + id: tracing::Id::from_u64(span_id), + metadata: meta_id, + }, + )); + } + + for causal_update in update.causality { + for update in trace::updates_from_pb(causal_update.update.unwrap()) { + if let Some(trace) = fresh.causality { + fresh.causality = trace.apply(update); + } + } + } + + let _ = self.current_task_details.borrow_mut().insert(fresh); } } @@ -264,12 +300,50 @@ impl Metadata { .into_iter() .map(|n| strings.string(n)) .collect(), + name: strings.string(pb.name), target: strings.string(pb.target), + location: pb + .location + .map(|pb| Location::from_proto(pb, strings)) + .unwrap_or_default(), id, } } } +// === impl Location === +impl Location { + fn from_proto(pb: proto::Location, strings: &mut intern::Strings) -> Self { + Self { + file: pb.file.map(|s| strings.string(s)), + module_path: pb.module_path.map(|s| strings.string(s)), + line: pb.line, + column: pb.column, + } + } +} + +impl Display for Location { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + if let Some(file) = &self.file { + write!(f, "{file}")?; + } else if let Some(module_path) = &self.module_path { + write!(f, "{module_path}")?; + } else { + return write!(f, "Location Unknown"); + } + + if let Some(line) = self.line { + write!(f, ":{line}")?; + if let Some(column) = self.column { + write!(f, ":{column}")?; + } + } + + Ok(()) + } +} + // === impl Field === impl Field { @@ -497,7 +571,7 @@ impl Attribute { } } -// === impl Ids === +// === impl Ids ===a impl Ids { pub(crate) fn id_for(&mut self, span_id: u64) -> u64 { diff --git a/tokio-console/src/state/tasks.rs b/tokio-console/src/state/tasks.rs index 22bc75de2..25cf4105b 100644 --- a/tokio-console/src/state/tasks.rs +++ b/tokio-console/src/state/tasks.rs @@ -14,6 +14,7 @@ use std::{ rc::{Rc, Weak}, time::{Duration, SystemTime}, }; +use tracing_causality::Trace; use tui::{style::Color, text::Span}; #[derive(Default, Debug)] @@ -25,10 +26,11 @@ pub(crate) struct TasksState { dropped_events: u64, } -#[derive(Debug, Default)] +#[derive(Debug)] pub(crate) struct Details { pub(crate) span_id: u64, pub(crate) poll_times_histogram: Option>, + pub(crate) causality: Option>, } #[derive(Debug, Copy, Clone)] @@ -66,6 +68,7 @@ pub(crate) struct Task { /// /// This is used when requesting a task details stream. span_id: u64, + meta_id: u64, short_desc: InternedStr, formatted_fields: Vec>>, stats: TaskStats, @@ -176,6 +179,7 @@ impl TasksState { name, num, span_id, + meta_id, short_desc, formatted_fields, stats, @@ -248,6 +252,10 @@ impl Task { self.span_id } + pub(crate) fn meta_id(&self) -> u64 { + self.meta_id + } + pub(crate) fn target(&self) -> &str { &self.target } diff --git a/tokio-console/src/state/trace.rs b/tokio-console/src/state/trace.rs new file mode 100644 index 000000000..e1ef0484f --- /dev/null +++ b/tokio-console/src/state/trace.rs @@ -0,0 +1,79 @@ +use console_api as proto; +use tracing_causality::{Span, Update}; + +fn span_from_pb(proto: proto::consequences::Span) -> Span { + Span { + id: proto.span_id.unwrap().into(), + metadata: proto.metadata_id.unwrap().id, + } +} + +pub(crate) fn updates_from_pb( + proto: proto::consequences::causality::Update, +) -> Box>> { + use proto::consequences::causality::Update as ProtoUpdate; + use std::iter::{once, repeat}; + match proto { + ProtoUpdate::Extant(proto::consequences::Extant { + cause: Some(cause), + direct_consequences, + indirect_consequences, + }) => { + let cause = span_from_pb(cause); + let direct_consequences = direct_consequences + .into_iter() + .zip(repeat(cause.clone())) + .map( + move |(consequence, cause)| tracing_causality::Update::OpenDirect { + cause: cause, + consequence: span_from_pb(consequence), + }, + ); + let indirect_consequences = indirect_consequences.into_iter().zip(repeat(cause)).map( + move |(consequence, cause)| tracing_causality::Update::NewIndirect { + cause: cause, + consequence: span_from_pb(consequence), + }, + ); + Box::new(direct_consequences.chain(indirect_consequences)) + } + ProtoUpdate::OpenDirect(proto::consequences::OpenDirect { + cause: Some(cause), + direct_consequences: Some(consequence), + }) => Box::new(once(tracing_causality::Update::OpenDirect { + cause: span_from_pb(cause), + consequence: span_from_pb(consequence), + })), + ProtoUpdate::NewIndirect(proto::consequences::NewIndirect { + cause: Some(cause), + indirect_consequences: Some(consequence), + }) => Box::new(once(tracing_causality::Update::NewIndirect { + cause: span_from_pb(cause), + consequence: span_from_pb(consequence), + })), + ProtoUpdate::CloseDirect(proto::consequences::CloseDirect { + span: Some(span), + direct_cause, + }) => Box::new(once(tracing_causality::Update::CloseDirect { + span: span_from_pb(span), + direct_cause: direct_cause.map(span_from_pb), + })), + ProtoUpdate::CloseIndirect(proto::consequences::CloseIndirect { + span: Some(span), + indirect_causes, + }) => Box::new(once(tracing_causality::Update::CloseIndirect { + span: span_from_pb(span), + indirect_causes: indirect_causes.into_iter().map(span_from_pb).collect(), + })), + ProtoUpdate::CloseCyclic(proto::consequences::CloseCyclic { + span: Some(span), + direct_cause, + indirect_causes, + }) => Box::new(once(tracing_causality::Update::CloseCyclic { + span: span_from_pb(span), + direct_cause: direct_cause.map(span_from_pb), + indirect_causes: indirect_causes.into_iter().map(span_from_pb).collect(), + })), + _ => unimplemented!(), + } +} diff --git a/tokio-console/src/view/mod.rs b/tokio-console/src/view/mod.rs index e22d239af..b9865ff98 100644 --- a/tokio-console/src/view/mod.rs +++ b/tokio-console/src/view/mod.rs @@ -186,7 +186,7 @@ impl View { let now = state .last_updated_at() .expect("task view implies we've received an update"); - view.render(&self.styles, frame, area, now); + view.render(&self.styles, frame, area, now, state); } ViewState::ResourceInstance(ref mut view) => { view.render(&self.styles, frame, area, state); diff --git a/tokio-console/src/view/task.rs b/tokio-console/src/view/task.rs index 0ee97e8aa..fb0a07fc0 100644 --- a/tokio-console/src/view/task.rs +++ b/tokio-console/src/view/task.rs @@ -2,7 +2,7 @@ use crate::{ input, state::{ tasks::{Details, Task}, - DetailsRef, + DetailsRef, State, }, util::Percentage, view::{ @@ -12,6 +12,7 @@ use crate::{ }; use std::{ cell::RefCell, + fmt, rc::Rc, time::{Duration, SystemTime}, }; @@ -41,6 +42,7 @@ impl TaskView { frame: &mut tui::terminal::Frame, area: layout::Rect, now: SystemTime, + state: &mut State, ) { // Rows with the following info: // - Task main attributes @@ -66,7 +68,7 @@ impl TaskView { }) .collect(); - let (controls_area, stats_area, poll_dur_area, fields_area, warnings_area) = + let (controls_area, stats_area, poll_dur_area, fields_area, stack_area, warnings_area) = if warnings.is_empty() { let chunks = Layout::default() .direction(layout::Direction::Vertical) @@ -79,12 +81,14 @@ impl TaskView { // poll duration layout::Constraint::Length(9), // fields - layout::Constraint::Percentage(60), + layout::Constraint::Length(3), + // stack + layout::Constraint::Percentage(50), ] .as_ref(), ) .split(area); - (chunks[0], chunks[1], chunks[2], chunks[3], None) + (chunks[0], chunks[1], chunks[2], chunks[3], chunks[4], None) } else { let chunks = Layout::default() .direction(layout::Direction::Vertical) @@ -99,13 +103,22 @@ impl TaskView { // poll duration layout::Constraint::Length(9), // fields - layout::Constraint::Percentage(60), + layout::Constraint::Length(3), + // stack + layout::Constraint::Percentage(50), ] .as_ref(), ) .split(area); - (chunks[0], chunks[2], chunks[3], chunks[4], Some(chunks[1])) + ( + chunks[0], + chunks[2], + chunks[3], + chunks[4], + chunks[5], + Some(chunks[1]), + ) }; let stats_area = Layout::default() @@ -254,6 +267,13 @@ impl TaskView { let task_widget = Paragraph::new(overview).block(styles.border_block().title("Task")); let wakers_widget = Paragraph::new(waker_stats).block(styles.border_block().title("Waker")); let fields_widget = Paragraph::new(fields).block(styles.border_block().title("Fields")); + let stack_widget = Paragraph::new( + details + .map(|details| details.make_stack_widget(styles, state)) + .unwrap_or_default(), + ) + .wrap(tui::widgets::Wrap { trim: true }) + .block(styles.border_block().title("Stack")); let percentiles_widget = Paragraph::new( details .map(|details| details.make_percentiles_widget(styles)) @@ -265,6 +285,7 @@ impl TaskView { frame.render_widget(task_widget, stats_area[0]); frame.render_widget(wakers_widget, stats_area[1]); frame.render_widget(fields_widget, fields_area); + frame.render_widget(stack_widget, stack_area); frame.render_widget(percentiles_widget, percentiles_area); } } @@ -332,6 +353,21 @@ impl Details { text.extend(percentiles); text } + + /// Render the consequences as an ascii tree. + fn make_stack_widget(&self, styles: &view::Styles, state: &State) -> Text<'static> { + // XXX(jswrenn): also implement an ASCII-only rendering mode + let mut buf = String::new(); + if let Some(causality) = self.causality.as_ref() { + let root = causality.root().clone(); + display(&mut buf, styles, state, causality, &root, true, "").unwrap(); + } else { + buf.push_str( + "An unexpected error prevents us from showing consequences for this task.", + ); + } + Text::from(buf) + } } fn dur(styles: &view::Styles, dur: std::time::Duration) -> Span<'static> { @@ -341,3 +377,56 @@ fn dur(styles: &view::Styles, dur: std::time::Duration) -> Span<'static> { // have to be given a string in order to do layout stuff? styles.time_units(format!("{:.prec$?}", dur, prec = DUR_PRECISION)) } + +fn display( + mut f: &mut W, + styles: &view::Styles, + state: &State, + tree: &tracing_causality::Trace, + root: &tracing_causality::Span, + is_last: bool, + prefix: &str, +) -> fmt::Result { + let metadata = state.metas.get(&root.metadata); + + let name = metadata + .map(|meta| format!("{}", meta.name.to_string())) + .unwrap_or(format!("{:?}", root)); + + let location = metadata + .map(|meta| format!(" ({})", meta.location)) + .unwrap_or("".to_string()); + + let root_fmt = format!("{}{}", name, location); + + let current; + let next; + + if is_last { + let pipes = if styles.utf8 { "└─" } else { "`-" }; + current = format!("{prefix}{pipes}\u{a0}{root_fmt}"); + next = format!("{}\u{a0}\u{a0}\u{a0}", prefix); + } else { + let pipes = if styles.utf8 { "├─" } else { "|-" }; + current = format!("{prefix}{pipes}\u{a0}{root_fmt}"); + next = format!("{}│\u{a0}\u{a0}", prefix); + } + + writeln!(&mut f, "{}", { + let mut current = current.chars(); + current.next().unwrap(); + current.next().unwrap(); + ¤t.as_str() + })?; + + if let Some(consequences) = tree.consequences(root) { + let direct = consequences.iter_direct(); + let len = direct.len(); + for (i, consequence) in direct.enumerate() { + let is_last = i == len - 1; + display(f, styles, state, tree, &consequence, is_last, &next)?; + } + } + + Ok(()) +}