From 46cfbf99a501bcb5572236553e14b4c8ca6238a6 Mon Sep 17 00:00:00 2001 From: asonix Date: Wed, 1 May 2024 14:50:20 -0500 Subject: [PATCH 1/4] Update metrics-exporter-prometheus This pulls in hyper 1 and http 1 --- Cargo.lock | 165 ++++++++++++++++++++++++++++++++++++++++++----------- Cargo.toml | 2 +- 2 files changed, 132 insertions(+), 35 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 39d3fcb..af5a9d7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -54,8 +54,8 @@ dependencies = [ "derive_more", "encoding_rs", "futures-core", - "h2", - "http", + "h2 0.3.26", + "http 0.2.12", "httparse", "httpdate", "itoa", @@ -102,7 +102,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d22475596539443685426b6bdadb926ad0ecaefdfc5fb05e5e3441f15463c511" dependencies = [ "bytestring", - "http", + "http 0.2.12", "regex", "serde", "tracing", @@ -377,9 +377,9 @@ dependencies = [ "bitflags 1.3.2", "bytes", "futures-util", - "http", - "http-body", - "hyper", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.28", "itoa", "matchit", "memchr", @@ -403,8 +403,8 @@ dependencies = [ "async-trait", "bytes", "futures-util", - "http", - "http-body", + "http 0.2.12", + "http-body 0.4.6", "mime", "rustversion", "tower-layer", @@ -1101,7 +1101,26 @@ dependencies = [ "futures-core", "futures-sink", "futures-util", - "http", + "http 0.2.12", + "indexmap 2.2.6", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "h2" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "816ec7294445779408f36fe57bc5b7fc1cf59664059096c65f905c1c61f58069" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http 1.1.0", "indexmap 2.2.6", "slab", "tokio", @@ -1181,6 +1200,17 @@ dependencies = [ "itoa", ] +[[package]] +name = "http" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + [[package]] name = "http-body" version = "0.4.6" @@ -1188,7 +1218,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", - "http", + "http 0.2.12", + "pin-project-lite", +] + +[[package]] +name = "http-body" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +dependencies = [ + "bytes", + "http 1.1.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" +dependencies = [ + "bytes", + "futures-core", + "http 1.1.0", + "http-body 1.0.0", "pin-project-lite", ] @@ -1220,9 +1273,9 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2", - "http", - "http-body", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", "httparse", "httpdate", "itoa", @@ -1234,6 +1287,27 @@ dependencies = [ "want", ] +[[package]] +name = "hyper" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe575dd17d0862a9a33781c8c4696a55c320909004a67a00fb286ba8b1bc496d" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "h2 0.4.4", + "http 1.1.0", + "http-body 1.0.0", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + [[package]] name = "hyper-rustls" version = "0.24.2" @@ -1241,8 +1315,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", - "http", - "hyper", + "http 0.2.12", + "hyper 0.14.28", "rustls 0.21.12", "tokio", "tokio-rustls 0.24.1", @@ -1254,12 +1328,32 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" dependencies = [ - "hyper", + "hyper 0.14.28", "pin-project-lite", "tokio", "tokio-io-timeout", ] +[[package]] +name = "hyper-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http 1.1.0", + "http-body 1.0.0", + "hyper 1.3.1", + "pin-project-lite", + "socket2 0.5.7", + "tokio", + "tower", + "tower-service", + "tracing", +] + [[package]] name = "iana-time-zone" version = "0.1.60" @@ -1474,12 +1568,14 @@ dependencies = [ [[package]] name = "metrics-exporter-prometheus" -version = "0.13.1" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bf4e7146e30ad172c42c39b3246864bd2d3c6396780711a1baf749cfe423e21" +checksum = "5d58e362dc7206e9456ddbcdbd53c71ba441020e62104703075a69151e38d85f" dependencies = [ - "base64 0.21.7", - "hyper", + "base64 0.22.1", + "http-body-util", + "hyper 1.3.1", + "hyper-util", "indexmap 2.2.6", "ipnet", "metrics", @@ -1487,6 +1583,7 @@ dependencies = [ "quanta", "thiserror", "tokio", + "tracing", ] [[package]] @@ -1642,7 +1739,7 @@ checksum = "1a016b8d9495c639af2145ac22387dcb88e44118e45320d9238fbf4e7889abcb" dependencies = [ "async-trait", "futures-core", - "http", + "http 0.2.12", "opentelemetry", "opentelemetry-proto", "opentelemetry-semantic-conventions", @@ -2212,10 +2309,10 @@ dependencies = [ "encoding_rs", "futures-core", "futures-util", - "h2", - "http", - "http-body", - "hyper", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.28", "hyper-rustls", "ipnet", "js-sys", @@ -2253,7 +2350,7 @@ checksum = "5a735987236a8e238bf0296c7e351b999c188ccc11477f311b82b55c93984216" dependencies = [ "anyhow", "async-trait", - "http", + "http 0.2.12", "reqwest", "serde", "task-local-extensions", @@ -3047,10 +3144,10 @@ dependencies = [ "axum", "base64 0.21.7", "bytes", - "h2", - "http", - "http-body", - "hyper", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.28", "hyper-timeout", "percent-encoding", "pin-project", @@ -3074,10 +3171,10 @@ dependencies = [ "axum", "base64 0.21.7", "bytes", - "h2", - "http", - "http-body", - "hyper", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.28", "hyper-timeout", "percent-encoding", "pin-project", diff --git a/Cargo.toml b/Cargo.toml index b939483..04b3dec 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,7 +38,7 @@ futures-core = "0.3" hex = "0.4.3" md-5 = "0.10.5" metrics = "0.22.0" -metrics-exporter-prometheus = { version = "0.13.0", default-features = false, features = ["http-listener"] } +metrics-exporter-prometheus = { version = "0.14.0", default-features = false, features = ["http-listener"] } mime = "0.3.1" nanorand = { version = "0.7", optional = true } opentelemetry_sdk = { version = "0.22", features = ["rt-tokio"] } From 89f3c447a8a313e57e9c5edc4a93364928ca7b2c Mon Sep 17 00:00:00 2001 From: asonix Date: Wed, 1 May 2024 14:57:03 -0500 Subject: [PATCH 2/4] clippy --- src/repo/sled.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/repo/sled.rs b/src/repo/sled.rs index ff45e04..575aa1e 100644 --- a/src/repo/sled.rs +++ b/src/repo/sled.rs @@ -807,7 +807,7 @@ impl QueueRepo for SledRepo { .read() .unwrap() .get(&queue_name) - .map(Arc::clone); + .cloned(); let notify = if let Some(notify) = opt { notify From bfd4fd46897de17b2b0e331524b5073dd7cbc9cd Mon Sep 17 00:00:00 2001 From: asonix Date: Fri, 3 May 2024 22:34:18 -0500 Subject: [PATCH 3/4] Remove unused StatusError type --- src/process.rs | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/process.rs b/src/process.rs index e31f15b..5d0b885 100644 --- a/src/process.rs +++ b/src/process.rs @@ -59,9 +59,6 @@ impl Drop for MetricsGuard { } } -#[derive(Debug)] -struct StatusError(ExitStatus); - pub(crate) struct Process { command: Arc, child: Child, @@ -487,11 +484,3 @@ impl ProcessRead { } } } - -impl std::fmt::Display for StatusError { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - write!(f, "Command failed with bad status: {}", self.0) - } -} - -impl std::error::Error for StatusError {} From d45e3fa386e62e0538b3d7ba399ceaec80fdd7ca Mon Sep 17 00:00:00 2001 From: asonix Date: Fri, 3 May 2024 22:35:20 -0500 Subject: [PATCH 4/4] Remove unused 'remove' repo method --- src/repo.rs | 5 ----- src/repo/postgres.rs | 18 ------------------ src/repo/sled.rs | 7 ------- 3 files changed, 30 deletions(-) diff --git a/src/repo.rs b/src/repo.rs index 9cbccc5..dfe3fcb 100644 --- a/src/repo.rs +++ b/src/repo.rs @@ -444,7 +444,6 @@ where pub(crate) trait SettingsRepo: BaseRepo { async fn set(&self, key: &'static str, value: Arc<[u8]>) -> Result<(), RepoError>; async fn get(&self, key: &'static str) -> Result>, RepoError>; - async fn remove(&self, key: &'static str) -> Result<(), RepoError>; } #[async_trait::async_trait(?Send)] @@ -459,10 +458,6 @@ where async fn get(&self, key: &'static str) -> Result>, RepoError> { T::get(self, key).await } - - async fn remove(&self, key: &'static str) -> Result<(), RepoError> { - T::remove(self, key).await - } } #[async_trait::async_trait(?Send)] diff --git a/src/repo/postgres.rs b/src/repo/postgres.rs index 6a546a9..cae7d09 100644 --- a/src/repo/postgres.rs +++ b/src/repo/postgres.rs @@ -1412,24 +1412,6 @@ impl SettingsRepo for PostgresRepo { Ok(opt) } - - #[tracing::instrument(level = "debug", skip(self))] - async fn remove(&self, input_key: &'static str) -> Result<(), RepoError> { - use schema::settings::dsl::*; - - let mut conn = self.get_connection().await?; - - diesel::delete(settings) - .filter(key.eq(input_key)) - .execute(&mut conn) - .with_metrics(crate::init_metrics::POSTGRES_SETTINGS_REMOVE) - .with_timeout(Duration::from_secs(5)) - .await - .map_err(|_| PostgresError::DbTimeout)? - .map_err(PostgresError::Diesel)?; - - Ok(()) - } } #[async_trait::async_trait(?Send)] diff --git a/src/repo/sled.rs b/src/repo/sled.rs index 575aa1e..af0e2cd 100644 --- a/src/repo/sled.rs +++ b/src/repo/sled.rs @@ -945,13 +945,6 @@ impl SettingsRepo for SledRepo { Ok(opt.map(|ivec| Arc::from(ivec.to_vec()))) } - - #[tracing::instrument(level = "trace", skip(self))] - async fn remove(&self, key: &'static str) -> Result<(), RepoError> { - b!(self.settings, settings.remove(key)); - - Ok(()) - } } fn variant_access_key(hash: &[u8], variant: &str) -> Vec {