From 56d4615b3aa11ba4c7ad74c8c61ef786912e58c3 Mon Sep 17 00:00:00 2001 From: Xavier Vello Date: Mon, 15 Apr 2024 16:20:52 +0200 Subject: [PATCH] cleanup and upgrade deps (#20) --- Cargo.lock | 545 ++++++++++++++++++--------------- Cargo.toml | 19 +- capture-server/Cargo.toml | 14 +- capture-server/src/main.rs | 5 +- capture-server/tests/common.rs | 17 +- capture-server/tests/events.rs | 10 +- capture/Cargo.toml | 9 +- capture/src/capture.rs | 3 +- capture/src/prometheus.rs | 3 +- capture/src/server.rs | 18 +- hook-api/Cargo.toml | 1 - hook-common/Cargo.toml | 2 - hook-janitor/Cargo.toml | 6 - hook-worker/Cargo.toml | 4 +- 14 files changed, 339 insertions(+), 317 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5f611e2..71cbc8d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -76,6 +76,28 @@ dependencies = [ "serde_json", ] +[[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.48", +] + [[package]] name = "async-trait" version = "0.1.77" @@ -140,11 +162,7 @@ dependencies = [ "pin-project-lite", "rustversion", "serde", - "serde_json", - "serde_path_to_error", - "serde_urlencoded", - "sync_wrapper", - "tokio", + "sync_wrapper 0.1.2", "tower", "tower-layer", "tower-service", @@ -152,15 +170,16 @@ dependencies = [ [[package]] name = "axum" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1236b4b292f6c4d6dc34604bb5120d85c3fe1d1aa596bd5cc52ca054d13e7b9e" +checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf" dependencies = [ "async-trait", "axum-core 0.4.3", + "axum-macros", "bytes", "futures-util", - "http 1.0.0", + "http 1.1.0", "http-body 1.0.0", "http-body-util", "hyper 1.1.0", @@ -176,7 +195,7 @@ dependencies = [ "serde_json", "serde_path_to_error", "serde_urlencoded", - "sync_wrapper", + "sync_wrapper 1.0.1", "tokio", "tower", "tower-layer", @@ -186,11 +205,11 @@ dependencies = [ [[package]] name = "axum-client-ip" -version = "0.4.2" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ef117890a418b7832678d9ea1e1c08456dd7b2fd1dadb9676cd6f0fe7eb4b21" +checksum = "72188bed20deb981f3a4a9fe674e5980fd9e9c2bd880baa94715ad5d60d64c67" dependencies = [ - "axum 0.6.20", + "axum 0.7.5", "forwarded-header-value", "serde", ] @@ -221,30 +240,41 @@ dependencies = [ "async-trait", "bytes", "futures-util", - "http 1.0.0", + "http 1.1.0", "http-body 1.0.0", "http-body-util", "mime", "pin-project-lite", "rustversion", - "sync_wrapper", + "sync_wrapper 0.1.2", "tower-layer", "tower-service", "tracing", ] [[package]] -name = "axum-test-helper" -version = "0.2.0" +name = "axum-macros" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91d349b3174ceac58442ea1f768233c817e59447c0343be2584fca9f0ed71d3a" +checksum = "00c055ee2d014ae5981ce1016374e8213682aa14d9bf40e48ab48b5f3ef20eaa" dependencies = [ - "axum 0.6.20", + "heck", + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "axum-test-helper" +version = "0.4.0" +source = "git+https://github.com/orphan-rs/axum-test-helper.git#8ca0aedaad5a6bdf351c34d5b80593ae1b7d2f3f" +dependencies = [ + "axum 0.7.5", "bytes", - "http 0.2.11", - "http-body 0.4.6", - "hyper 0.14.28", - "reqwest", + "http 1.1.0", + "http-body 1.0.0", + "hyper 1.1.0", + "reqwest 0.11.24", "serde", "tokio", "tower", @@ -272,6 +302,12 @@ version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +[[package]] +name = "base64" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51" + [[package]] name = "base64ct" version = "1.6.0" @@ -327,22 +363,19 @@ dependencies = [ "anyhow", "assert-json-diff", "async-trait", - "axum 0.6.20", + "axum 0.7.5", "axum-client-ip", "axum-test-helper", - "base64", + "base64 0.22.0", "bytes", - "dashmap", "envconfig", "flate2", "governor", "metrics", "metrics-exporter-prometheus", - "mockall", "rand", "rdkafka", "redis", - "redis-test", "serde", "serde_json", "serde_urlencoded", @@ -350,9 +383,7 @@ dependencies = [ "time", "tokio", "tower-http", - "tower_governor", "tracing", - "tracing-subscriber", "uuid", ] @@ -362,7 +393,6 @@ version = "0.1.0" dependencies = [ "anyhow", "assert-json-diff", - "axum 0.7.4", "capture", "envconfig", "futures", @@ -372,9 +402,8 @@ dependencies = [ "opentelemetry_sdk", "rand", "rdkafka", - "reqwest", + "reqwest 0.12.3", "serde_json", - "time", "tokio", "tracing", "tracing-opentelemetry", @@ -571,12 +600,6 @@ dependencies = [ "serde", ] -[[package]] -name = "difflib" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8" - [[package]] name = "digest" version = "0.10.7" @@ -595,12 +618,6 @@ version = "0.15.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" -[[package]] -name = "downcast" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" - [[package]] name = "either" version = "1.9.0" @@ -704,15 +721,6 @@ dependencies = [ "miniz_oxide", ] -[[package]] -name = "float-cmp" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4" -dependencies = [ - "num-traits", -] - [[package]] name = "flume" version = "0.11.0" @@ -764,12 +772,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "fragile" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" - [[package]] name = "futures" version = "0.3.30" @@ -957,7 +959,7 @@ dependencies = [ "futures-core", "futures-sink", "futures-util", - "http 1.0.0", + "http 1.1.0", "indexmap 2.2.2", "slab", "tokio", @@ -1051,13 +1053,12 @@ dependencies = [ name = "hook-api" version = "0.1.0" dependencies = [ - "axum 0.7.4", + "axum 0.7.5", "envconfig", "eyre", "hook-common", "http-body-util", "metrics", - "metrics-exporter-prometheus", "serde", "serde_derive", "serde_json", @@ -1074,15 +1075,13 @@ name = "hook-common" version = "0.1.0" dependencies = [ "async-trait", - "axum 0.7.4", + "axum 0.7.5", "chrono", - "http 0.2.11", + "http 1.1.0", "metrics", "metrics-exporter-prometheus", - "regex", - "reqwest", + "reqwest 0.12.3", "serde", - "serde_derive", "serde_json", "sqlx", "thiserror", @@ -1097,42 +1096,34 @@ name = "hook-janitor" version = "0.1.0" dependencies = [ "async-trait", - "axum 0.7.4", + "axum 0.7.5", "envconfig", "eyre", "futures", "hook-common", - "http-body-util", "metrics", - "metrics-exporter-prometheus", "rdkafka", - "serde", - "serde_derive", "serde_json", "sqlx", "thiserror", "time", "tokio", - "tower", "tracing", "tracing-subscriber", - "url", ] [[package]] name = "hook-worker" version = "0.1.0" dependencies = [ - "axum 0.7.4", + "axum 0.7.5", "chrono", "envconfig", "futures", "hook-common", - "http 0.2.11", + "http 1.1.0", "metrics", - "reqwest", - "serde", - "serde_derive", + "reqwest 0.12.3", "sqlx", "thiserror", "time", @@ -1155,9 +1146,9 @@ dependencies = [ [[package]] name = "http" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" dependencies = [ "bytes", "fnv", @@ -1182,7 +1173,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" dependencies = [ "bytes", - "http 1.0.0", + "http 1.1.0", ] [[package]] @@ -1193,17 +1184,11 @@ checksum = "41cb79eb393015dadd30fc252023adb0b2400a0caee0fa2a077e6e21a551e840" dependencies = [ "bytes", "futures-util", - "http 1.0.0", + "http 1.1.0", "http-body 1.0.0", "pin-project-lite", ] -[[package]] -name = "http-range-header" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "add0ab9360ddbd88cfeb3bd9574a1d85cfdfa14db10b3e21d3700dbc4328758f" - [[package]] name = "httparse" version = "1.8.0" @@ -1250,13 +1235,28 @@ dependencies = [ "futures-channel", "futures-util", "h2 0.4.2", - "http 1.0.0", + "http 1.1.0", "http-body 1.0.0", "httparse", "httpdate", "itoa", "pin-project-lite", "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" +dependencies = [ + "futures-util", + "http 0.2.11", + "hyper 0.14.28", + "rustls", + "tokio", + "tokio-rustls", ] [[package]] @@ -1273,15 +1273,18 @@ dependencies = [ [[package]] name = "hyper-tls" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", - "hyper 0.14.28", + "http-body-util", + "hyper 1.1.0", + "hyper-util", "native-tls", "tokio", "tokio-native-tls", + "tower-service", ] [[package]] @@ -1291,13 +1294,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" dependencies = [ "bytes", + "futures-channel", "futures-util", - "http 1.0.0", + "http 1.1.0", "http-body 1.0.0", "hyper 1.1.0", "pin-project-lite", "socket2 0.5.5", "tokio", + "tower", + "tower-service", + "tracing", ] [[package]] @@ -1365,15 +1372,6 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.12.1" @@ -1516,14 +1514,16 @@ dependencies = [ [[package]] name = "metrics-exporter-prometheus" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83a4c4718a371ddfb7806378f23617876eea8b82e5ff1324516bcd283249d9ea" +checksum = "5d58e362dc7206e9456ddbcdbd53c71ba441020e62104703075a69151e38d85f" dependencies = [ - "base64", - "hyper 0.14.28", + "base64 0.22.0", + "http-body-util", + "hyper 1.1.0", "hyper-tls", - "indexmap 1.9.3", + "hyper-util", + "indexmap 2.2.2", "ipnet", "metrics", "metrics-util", @@ -1590,33 +1590,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "mockall" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c84490118f2ee2d74570d114f3d0493cbf02790df303d2707606c3e14e07c96" -dependencies = [ - "cfg-if", - "downcast", - "fragile", - "lazy_static", - "mockall_derive", - "predicates", - "predicates-tree", -] - -[[package]] -name = "mockall_derive" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ce75669015c4f47b289fd4d4f56e894e4c96003ffdf3ac51313126f94c6cbb" -dependencies = [ - "cfg-if", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "native-tls" version = "0.2.11" @@ -1674,12 +1647,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38bf9645c8b145698bb0b18a4637dcacbc421ea49bef2317e4fd8065a387cf21" -[[package]] -name = "normalize-line-endings" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" - [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -1836,13 +1803,12 @@ dependencies = [ [[package]] name = "opentelemetry" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e32339a5dc40459130b3bd269e9892439f55b33e772d2a9d402a789baaf4e8a" +checksum = "900d57987be3f2aeb70d385fff9b27fb74c5723cc9a52d904d4f9c807a0667bf" dependencies = [ "futures-core", "futures-sink", - "indexmap 2.2.2", "js-sys", "once_cell", "pin-project-lite", @@ -1852,9 +1818,9 @@ dependencies = [ [[package]] name = "opentelemetry-otlp" -version = "0.14.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f24cda83b20ed2433c68241f918d0f6fdec8b1d43b7a9590ab4420c5095ca930" +checksum = "1a016b8d9495c639af2145ac22387dcb88e44118e45320d9238fbf4e7889abcb" dependencies = [ "async-trait", "futures-core", @@ -1871,9 +1837,9 @@ dependencies = [ [[package]] name = "opentelemetry-proto" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2e155ce5cc812ea3d1dffbd1539aed653de4bf4882d60e6e04dcf0901d674e1" +checksum = "3a8fddc9b68f5b80dae9d6f510b88e02396f006ad48cac349411fbecc80caae4" dependencies = [ "opentelemetry", "opentelemetry_sdk", @@ -1883,18 +1849,15 @@ dependencies = [ [[package]] name = "opentelemetry-semantic-conventions" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5774f1ef1f982ef2a447f6ee04ec383981a3ab99c8e77a1a7b30182e65bbc84" -dependencies = [ - "opentelemetry", -] +checksum = "f9ab5bd6c42fb9349dcf28af2ba9a0667f697f9bdcca045d39f2cec5543e2910" [[package]] name = "opentelemetry_sdk" -version = "0.21.2" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f16aec8a98a457a52664d69e0091bac3a0abd18ead9b641cb00202ba4e0efe4" +checksum = "9e90c7113be649e31e9a0f8b5ee24ed7a16923b322c3c5ab6367469c049d6b7e" dependencies = [ "async-trait", "crossbeam-channel", @@ -2048,36 +2011,6 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" -[[package]] -name = "predicates" -version = "2.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59230a63c37f3e18569bdb90e4a89cbf5bf8b06fea0b84e65ea10cc4df47addd" -dependencies = [ - "difflib", - "float-cmp", - "itertools 0.10.5", - "normalize-line-endings", - "predicates-core", - "regex", -] - -[[package]] -name = "predicates-core" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b794032607612e7abeb4db69adb4e33590fa6cf1149e95fd7cb00e634b92f174" - -[[package]] -name = "predicates-tree" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368ba315fb8c5052ab692e68a0eefec6ec57b23a36959c14496f0b0df2c0cecf" -dependencies = [ - "predicates-core", - "termtree", -] - [[package]] name = "proc-macro-crate" version = "1.3.1" @@ -2099,9 +2032,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.11.9" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" +checksum = "d0f5d036824e4761737860779c906171497f6d55681139d8312388f8fe398922" dependencies = [ "bytes", "prost-derive", @@ -2109,15 +2042,15 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.11.9" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" +checksum = "19de2de2a00075bf566bee3bd4db014b11587e84184d3f7a791bc17f1a8e9e48" dependencies = [ "anyhow", - "itertools 0.10.5", + "itertools", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.48", ] [[package]] @@ -2266,15 +2199,6 @@ dependencies = [ "url", ] -[[package]] -name = "redis-test" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aba266ca48ae66978bf439fd2ac0d7a36a8635823754e2bc73afaf9d2fc25272" -dependencies = [ - "redis", -] - [[package]] name = "redox_syscall" version = "0.4.1" @@ -2334,7 +2258,7 @@ version = "0.11.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6920094eb85afde5e4a138be3f2de8bbdf28000f0029e72c45025a56b042251" dependencies = [ - "base64", + "base64 0.21.7", "bytes", "encoding_rs", "futures-core", @@ -2343,24 +2267,24 @@ dependencies = [ "http 0.2.11", "http-body 0.4.6", "hyper 0.14.28", - "hyper-tls", + "hyper-rustls", "ipnet", "js-sys", "log", "mime", "mime_guess", - "native-tls", "once_cell", "percent-encoding", "pin-project-lite", - "rustls-pemfile", + "rustls", + "rustls-pemfile 1.0.4", "serde", "serde_json", "serde_urlencoded", - "sync_wrapper", + "sync_wrapper 0.1.2", "system-configuration", "tokio", - "tokio-native-tls", + "tokio-rustls", "tokio-util", "tower-service", "url", @@ -2368,7 +2292,65 @@ dependencies = [ "wasm-bindgen-futures", "wasm-streams", "web-sys", - "winreg", + "webpki-roots", + "winreg 0.50.0", +] + +[[package]] +name = "reqwest" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e6cc1e89e689536eb5aeede61520e874df5a4707df811cd5da4aa5fbb2aae19" +dependencies = [ + "base64 0.22.0", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2 0.4.2", + "http 1.1.0", + "http-body 1.0.0", + "http-body-util", + "hyper 1.1.0", + "hyper-tls", + "hyper-util", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls-pemfile 2.1.2", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper 0.1.2", + "system-configuration", + "tokio", + "tokio-native-tls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg 0.52.0", +] + +[[package]] +name = "ring" +version = "0.17.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +dependencies = [ + "cc", + "cfg-if", + "getrandom", + "libc", + "spin 0.9.8", + "untrusted", + "windows-sys 0.52.0", ] [[package]] @@ -2410,13 +2392,51 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "rustls" +version = "0.21.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" +dependencies = [ + "log", + "ring", + "rustls-webpki", + "sct", +] + [[package]] name = "rustls-pemfile" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ - "base64", + "base64 0.21.7", +] + +[[package]] +name = "rustls-pemfile" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" +dependencies = [ + "base64 0.22.0", + "rustls-pki-types", +] + +[[package]] +name = "rustls-pki-types" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecd36cc4259e3e4514335c4a138c6b43171a8d61d8f5c9348f9fc7529416f247" + +[[package]] +name = "rustls-webpki" +version = "0.101.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +dependencies = [ + "ring", + "untrusted", ] [[package]] @@ -2446,6 +2466,16 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sct" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "security-framework" version = "2.9.2" @@ -2650,7 +2680,7 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce81b7bd7c4493975347ef60d8c7e8b742d4694f4c49f93e0a12ea263938176c" dependencies = [ - "itertools 0.12.1", + "itertools", "nom", "unicode_categories", ] @@ -2758,7 +2788,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e37195395df71fd068f6e2082247891bc11e3289624bbc776a0cdfa1ca7f1ea4" dependencies = [ "atoi", - "base64", + "base64 0.21.7", "bitflags 2.4.2", "byteorder", "bytes", @@ -2802,7 +2832,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6ac0ac3b7ccd10cc96c7ab29791a7dd236bd94021f31eec7ba3d46a74aa1c24" dependencies = [ "atoi", - "base64", + "base64 0.21.7", "bitflags 2.4.2", "byteorder", "chrono", @@ -2906,6 +2936,12 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +[[package]] +name = "sync_wrapper" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" + [[package]] name = "system-configuration" version = "0.5.1" @@ -2939,12 +2975,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "termtree" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" - [[package]] name = "thiserror" version = "1.0.56" @@ -3071,6 +3101,16 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-rustls" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +dependencies = [ + "rustls", + "tokio", +] + [[package]] name = "tokio-stream" version = "0.1.14" @@ -3115,16 +3155,15 @@ dependencies = [ [[package]] name = "tonic" -version = "0.9.2" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3082666a3a6433f7f511c7192923fa1fe07c69332d3c6a2e6bb040b569199d5a" +checksum = "76c4eb7a4e9ef9d4763600161f12f5070b92a578e1b634db88a6887844c91a13" dependencies = [ + "async-stream", "async-trait", "axum 0.6.20", - "base64", + "base64 0.21.7", "bytes", - "futures-core", - "futures-util", "h2 0.3.24", "http 0.2.11", "http-body 0.4.6", @@ -3163,17 +3202,15 @@ dependencies = [ [[package]] name = "tower-http" -version = "0.4.4" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61c5bb1d698276a2443e5ecfabc1008bf15a36c12e6a7176e7bf089ea9131140" +checksum = "1e9cd434a998747dd2c4276bc96ee2e0c7a2eadf3cae88e52be55a05fa9053f5" dependencies = [ "bitflags 2.4.2", "bytes", - "futures-core", - "futures-util", - "http 0.2.11", - "http-body 0.4.6", - "http-range-header", + "http 1.1.0", + "http-body 1.0.0", + "http-body-util", "pin-project-lite", "tower-layer", "tower-service", @@ -3192,26 +3229,6 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" -[[package]] -name = "tower_governor" -version = "0.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c6be418f6d18863291f0a7fa1da1de71495a19a54b5fb44969136f731a47e86" -dependencies = [ - "axum 0.6.20", - "forwarded-header-value", - "futures", - "futures-core", - "governor", - "http 0.2.11", - "pin-project", - "thiserror", - "tokio", - "tower", - "tower-layer", - "tracing", -] - [[package]] name = "tracing" version = "0.1.40" @@ -3258,9 +3275,9 @@ dependencies = [ [[package]] name = "tracing-opentelemetry" -version = "0.22.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c67ac25c5407e7b961fafc6f7e9aa5958fd297aada2d20fa2ae1737357e55596" +checksum = "a9be14ba1bbe4ab79e9229f7f89fab8d120b865859f10527f31c033e599d2284" dependencies = [ "js-sys", "once_cell", @@ -3346,6 +3363,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + [[package]] name = "url" version = "2.5.0" @@ -3504,14 +3527,20 @@ dependencies = [ [[package]] name = "web-time" -version = "0.2.4" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa30049b1c872b72c89866d458eae9f20380ab280ffd1b1e18df2d3e2d98cfe0" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" dependencies = [ "js-sys", "wasm-bindgen", ] +[[package]] +name = "webpki-roots" +version = "0.25.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" + [[package]] name = "whoami" version = "1.4.1" @@ -3700,6 +3729,16 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "winreg" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + [[package]] name = "zerocopy" version = "0.7.32" diff --git a/Cargo.toml b/Cargo.toml index 3aeacb8..f77c1fb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,16 +10,13 @@ members = [ "hook-janitor", ] -# [profile.release] -# debug = 2 # https://www.polarsignals.com/docs/rust - [workspace.dependencies] anyhow = "1.0" assert-json-diff = "2.0.2" async-trait = "0.1.74" -axum = { version = "0.7.1", features = ["http2"] } -axum-client-ip = "0.4.1" -base64 = "0.21.1" +axum = { version = "0.7.5", features = ["http2", "macros"] } +axum-client-ip = "0.6.0" +base64 = "0.22.0" bytes = "1" chrono = { version = "0.4" } envconfig = "0.10.0" @@ -27,14 +24,13 @@ eyre = "0.6.9" flate2 = "1.0" futures = { version = "0.3.29" } governor = { version = "0.5.1", features = ["dashmap"] } -http = { version = "0.2" } +http = { version = "1.1.0" } http-body-util = "0.1.0" metrics = "0.22.0" -metrics-exporter-prometheus = "0.13.0" +metrics-exporter-prometheus = "0.14.0" rand = "0.8.5" rdkafka = { version = "0.36.0", features = ["cmake-build", "ssl", "tracing"] } -regex = "1.10.2" -reqwest = { version = "0.11" } +reqwest = { version = "0.12.3" } serde = { version = "1.0", features = ["derive"] } serde_derive = { version = "1.0" } serde_json = { version = "1.0" } @@ -57,8 +53,7 @@ time = { version = "0.3.20", features = [ ] } tokio = { version = "1.34.0", features = ["full"] } tower = "0.4.13" -tower_governor = "0.0.4" -tower-http = { version = "0.4.0", features = ["cors", "trace"] } +tower-http = { version = "0.5.2", features = ["cors", "trace"] } tracing = "0.1.40" tracing-subscriber = "0.3.18" url = { version = "2.5.0 " } diff --git a/capture-server/Cargo.toml b/capture-server/Cargo.toml index e8aa559..ae06664 100644 --- a/capture-server/Cargo.toml +++ b/capture-server/Cargo.toml @@ -4,16 +4,14 @@ version = "0.1.0" edition = "2021" [dependencies] -axum = { workspace = true } capture = { path = "../capture" } envconfig = { workspace = true } -opentelemetry = { version = "0.21.0", features = ["trace"]} -opentelemetry-otlp = "0.14.0" -opentelemetry_sdk = { version = "0.21.0", features = ["trace", "rt-tokio"] } -time = { workspace = true } +opentelemetry = { version = "0.22.0", features = ["trace"]} +opentelemetry-otlp = "0.15.0" +opentelemetry_sdk = { version = "0.22.1", features = ["trace", "rt-tokio"] } tokio = { workspace = true } tracing = { workspace = true } -tracing-opentelemetry = "0.22.0" +tracing-opentelemetry = "0.23.0" tracing-subscriber = { workspace = true, features = ["env-filter"] } [dev-dependencies] @@ -23,5 +21,5 @@ futures = "0.3.29" once_cell = "1.18.0" rand = { workspace = true } rdkafka = { workspace = true } -reqwest = "0.11.22" -serde_json = { workspace = true } \ No newline at end of file +reqwest = { workspace = true } +serde_json = { workspace = true } diff --git a/capture-server/src/main.rs b/capture-server/src/main.rs index 402fc32..97967ed 100644 --- a/capture-server/src/main.rs +++ b/capture-server/src/main.rs @@ -1,4 +1,3 @@ -use std::net::TcpListener; use std::time::Duration; use envconfig::Envconfig; @@ -76,6 +75,8 @@ async fn main() { .init(); // Open the TCP port and start the server - let listener = TcpListener::bind(config.address).unwrap(); + let listener = tokio::net::TcpListener::bind(config.address) + .await + .expect("could not bind port"); serve(config, listener, shutdown()).await } diff --git a/capture-server/tests/common.rs b/capture-server/tests/common.rs index fa86881..e33ef4c 100644 --- a/capture-server/tests/common.rs +++ b/capture-server/tests/common.rs @@ -1,7 +1,7 @@ #![allow(dead_code)] use std::default::Default; -use std::net::{SocketAddr, TcpListener}; +use std::net::SocketAddr; use std::num::NonZeroU32; use std::str::FromStr; use std::string::ToString; @@ -17,6 +17,7 @@ use rdkafka::config::{ClientConfig, FromClientConfig}; use rdkafka::consumer::{BaseConsumer, Consumer}; use rdkafka::util::Timeout; use rdkafka::{Message, TopicPartitionList}; +use tokio::net::TcpListener; use tokio::sync::Notify; use tokio::time::timeout; use tracing::{debug, warn}; @@ -59,20 +60,20 @@ pub struct ServerHandle { } impl ServerHandle { - pub fn for_topic(topic: &EphemeralTopic) -> Self { + pub async fn for_topic(topic: &EphemeralTopic) -> Self { let mut config = DEFAULT_CONFIG.clone(); config.kafka.kafka_topic = topic.topic_name().to_string(); - Self::for_config(config) + Self::for_config(config).await } - pub fn for_config(config: Config) -> Self { - let listener = TcpListener::bind("127.0.0.1:0").unwrap(); + pub async fn for_config(config: Config) -> Self { + let listener = TcpListener::bind("127.0.0.1:0").await.unwrap(); let addr = listener.local_addr().unwrap(); let notify = Arc::new(Notify::new()); let shutdown = notify.clone(); - tokio::spawn( - async move { serve(config, listener, async { notify.notified().await }).await }, - ); + tokio::spawn(async move { + serve(config, listener, async move { notify.notified().await }).await + }); Self { addr, shutdown } } diff --git a/capture-server/tests/events.rs b/capture-server/tests/events.rs index 56fcdf7..8a4220b 100644 --- a/capture-server/tests/events.rs +++ b/capture-server/tests/events.rs @@ -14,7 +14,7 @@ async fn it_captures_one_event() -> Result<()> { let token = random_string("token", 16); let distinct_id = random_string("id", 16); let topic = EphemeralTopic::new().await; - let server = ServerHandle::for_topic(&topic); + let server = ServerHandle::for_topic(&topic).await; let event = json!({ "token": token, @@ -44,7 +44,7 @@ async fn it_captures_a_batch() -> Result<()> { let distinct_id2 = random_string("id", 16); let topic = EphemeralTopic::new().await; - let server = ServerHandle::for_topic(&topic); + let server = ServerHandle::for_topic(&topic).await; let event = json!([{ "token": token, @@ -90,7 +90,7 @@ async fn it_overflows_events_on_burst() -> Result<()> { config.overflow_burst_limit = NonZeroU32::new(2).unwrap(); config.overflow_per_second_limit = NonZeroU32::new(1).unwrap(); - let server = ServerHandle::for_config(config); + let server = ServerHandle::for_config(config).await; let event = json!([{ "token": token, @@ -139,7 +139,7 @@ async fn it_does_not_overflow_team_with_different_ids() -> Result<()> { config.overflow_burst_limit = NonZeroU32::new(1).unwrap(); config.overflow_per_second_limit = NonZeroU32::new(1).unwrap(); - let server = ServerHandle::for_config(config); + let server = ServerHandle::for_config(config).await; let event = json!([{ "token": token, @@ -176,7 +176,7 @@ async fn it_trims_distinct_id() -> Result<()> { let (trimmed_distinct_id2, _) = distinct_id2.split_at(200); // works because ascii chars let topic = EphemeralTopic::new().await; - let server = ServerHandle::for_topic(&topic); + let server = ServerHandle::for_topic(&topic).await; let event = json!([{ "token": token, diff --git a/capture/Cargo.toml b/capture/Cargo.toml index bd8f79f..9ec0f97 100644 --- a/capture/Cargo.toml +++ b/capture/Cargo.toml @@ -6,15 +6,13 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -axum = { version = "0.6.15" } # TODO: Bring up to date with the workspace. +axum = { workspace = true } axum-client-ip = { workspace = true } tokio = { workspace = true } tracing = { workspace = true } -tracing-subscriber = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } governor = { workspace = true } -tower_governor = { workspace = true } time = { workspace = true } tower-http = { workspace = true } bytes = { workspace = true } @@ -35,10 +33,7 @@ redis = { version = "0.23.3", features = [ "cluster-async", ] } envconfig = { workspace = true } -dashmap = "5.5.3" [dev-dependencies] assert-json-diff = { workspace = true } -axum-test-helper = "0.2.0" -mockall = "0.11.2" -redis-test = "0.2.3" +axum-test-helper = { git = "https://github.com/orphan-rs/axum-test-helper.git" } # TODO: remove, directly use reqwest like capture-server tests diff --git a/capture/src/capture.rs b/capture/src/capture.rs index 7f90d57..622bc75 100644 --- a/capture/src/capture.rs +++ b/capture/src/capture.rs @@ -4,7 +4,7 @@ use std::sync::Arc; use bytes::Bytes; -use axum::Json; +use axum::{debug_handler, Json}; // TODO: stream this instead use axum::extract::{Query, State}; use axum::http::{HeaderMap, Method}; @@ -38,6 +38,7 @@ use crate::{ compression ) )] +#[debug_handler] pub async fn event( state: State, InsecureClientIp(ip): InsecureClientIp, diff --git a/capture/src/prometheus.rs b/capture/src/prometheus.rs index 6f5dc12..b4e1997 100644 --- a/capture/src/prometheus.rs +++ b/capture/src/prometheus.rs @@ -2,6 +2,7 @@ use std::time::Instant; +use axum::body::Body; use axum::{extract::MatchedPath, http::Request, middleware::Next, response::IntoResponse}; use metrics::counter; use metrics_exporter_prometheus::{Matcher, PrometheusBuilder, PrometheusHandle}; @@ -38,7 +39,7 @@ pub fn setup_metrics_recorder() -> PrometheusHandle { /// Middleware to record some common HTTP metrics /// Generic over B to allow for arbitrary body types (eg Vec, Streams, a deserialized thing, etc) /// Someday tower-http might provide a metrics middleware: https://github.com/tower-rs/tower-http/issues/57 -pub async fn track_metrics(req: Request, next: Next) -> impl IntoResponse { +pub async fn track_metrics(req: Request, next: Next) -> impl IntoResponse { let start = Instant::now(); let path = if let Some(matched_path) = req.extensions().get::() { diff --git a/capture/src/server.rs b/capture/src/server.rs index 22a1f3b..2fc88c6 100644 --- a/capture/src/server.rs +++ b/capture/src/server.rs @@ -1,8 +1,9 @@ use std::future::Future; -use std::net::{SocketAddr, TcpListener}; +use std::net::SocketAddr; use std::sync::Arc; use time::Duration; +use tokio::net::TcpListener; use crate::config::Config; use crate::health::{ComponentStatus, HealthRegistry}; @@ -15,7 +16,7 @@ use crate::sinks::print::PrintSink; pub async fn serve(config: Config, listener: TcpListener, shutdown: F) where - F: Future, + F: Future + Send + 'static, { let liveness = HealthRegistry::new("liveness"); @@ -80,10 +81,11 @@ where // run our app with hyper // `axum::Server` is a re-export of `hyper::Server` tracing::info!("listening on {:?}", listener.local_addr().unwrap()); - axum::Server::from_tcp(listener) - .unwrap() - .serve(app.into_make_service_with_connect_info::()) - .with_graceful_shutdown(shutdown) - .await - .unwrap() + axum::serve( + listener, + app.into_make_service_with_connect_info::(), + ) + .with_graceful_shutdown(shutdown) + .await + .unwrap() } diff --git a/hook-api/Cargo.toml b/hook-api/Cargo.toml index 96c897c..a596e87 100644 --- a/hook-api/Cargo.toml +++ b/hook-api/Cargo.toml @@ -12,7 +12,6 @@ eyre = { workspace = true } hook-common = { path = "../hook-common" } http-body-util = { workspace = true } metrics = { workspace = true } -metrics-exporter-prometheus = { workspace = true } serde = { workspace = true } serde_derive = { workspace = true } serde_json = { workspace = true } diff --git a/hook-common/Cargo.toml b/hook-common/Cargo.toml index ea7ce2f..8ccf8dd 100644 --- a/hook-common/Cargo.toml +++ b/hook-common/Cargo.toml @@ -13,9 +13,7 @@ http = { workspace = true } metrics = { workspace = true } metrics-exporter-prometheus = { workspace = true } reqwest = { workspace = true } -regex = { workspace = true } serde = { workspace = true } -serde_derive = { workspace = true } serde_json = { workspace = true } sqlx = { workspace = true } time = { workspace = true } diff --git a/hook-janitor/Cargo.toml b/hook-janitor/Cargo.toml index 96a80eb..a29a80c 100644 --- a/hook-janitor/Cargo.toml +++ b/hook-janitor/Cargo.toml @@ -12,18 +12,12 @@ envconfig = { workspace = true } eyre = { workspace = true } futures = { workspace = true } hook-common = { path = "../hook-common" } -http-body-util = { workspace = true } metrics = { workspace = true } -metrics-exporter-prometheus = { workspace = true } rdkafka = { workspace = true } -serde = { workspace = true } -serde_derive = { workspace = true } serde_json = { workspace = true } sqlx = { workspace = true } time = { workspace = true } thiserror = { workspace = true } tokio = { workspace = true } -tower = { workspace = true } tracing = { workspace = true } tracing-subscriber = { workspace = true } -url = { workspace = true } diff --git a/hook-worker/Cargo.toml b/hook-worker/Cargo.toml index 6ed5796..5d6874a 100644 --- a/hook-worker/Cargo.toml +++ b/hook-worker/Cargo.toml @@ -9,11 +9,9 @@ chrono = { workspace = true } envconfig = { workspace = true } futures = "0.3" hook-common = { path = "../hook-common" } -http = { version = "0.2" } +http = { workspace = true } metrics = { workspace = true } reqwest = { workspace = true } -serde = { workspace = true } -serde_derive = { workspace = true } sqlx = { workspace = true } time = { workspace = true } thiserror = { workspace = true }