diff --git a/Cargo.lock b/Cargo.lock index 2b2d8dca0..513c729aa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -334,9 +334,9 @@ dependencies = [ [[package]] name = "aws-sdk-ec2" -version = "0.30.0" +version = "0.33.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcb3e58549904567dcbfadb1e450b5a0f46f35300dd78c87a31ca4761d1481f6" +checksum = "85092ae53cec4fb99eed322e2b5b5946818e23e92b36db07cf344a6e77e4b617" dependencies = [ "aws-credential-types", "aws-http", @@ -360,9 +360,9 @@ dependencies = [ [[package]] name = "aws-sdk-iam" -version = "0.30.0" +version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "725e8b399d7a50dd180ec0919af96a8e2df1ee0ee7777781bda3f954a25e1e06" +checksum = "c156518d848e19806efacdd92d84de7e199107c0b17b3a06d8944db5f7982b09" dependencies = [ "aws-credential-types", "aws-http", @@ -385,9 +385,9 @@ dependencies = [ [[package]] name = "aws-sdk-kms" -version = "0.30.0" +version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92f134e75581d16a36a6d7e6dd8b6cdef5cbc610e599a8c12df317eb7868c8b" +checksum = "18fc2429ded0e8249b0ea514e519fbe684b46bb45cc35f596f19d7166c94b9c6" dependencies = [ "aws-credential-types", "aws-http", @@ -629,9 +629,9 @@ dependencies = [ [[package]] name = "aws-throwaway" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95bea09d88038bfecb5c0af4b3a25346985d16f061d717a649fd212482d5e650" +checksum = "b3f374d093490b2813e213a5bc2e4f0bfada9921d1529a08bad22ac71a80b7a6" dependencies = [ "anyhow", "async-trait", @@ -2379,16 +2379,16 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.57" +version = "0.1.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" +checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows", + "windows-core", ] [[package]] @@ -2599,9 +2599,9 @@ checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" [[package]] name = "lock_api" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" dependencies = [ "autocfg", "scopeguard", @@ -3175,13 +3175,13 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.8" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.3.5", + "redox_syscall 0.4.1", "smallvec", "windows-targets 0.48.5", ] @@ -3680,6 +3680,15 @@ dependencies = [ "bitflags 1.3.2", ] +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + [[package]] name = "redox_users" version = "0.4.3" @@ -3881,9 +3890,9 @@ dependencies = [ [[package]] name = "russh" -version = "0.38.0" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae0efcc0f4cd6c062c07e572ce4b806e3967fa029fcbfcc0aa98fb5910a37925" +checksum = "7878311587d0353a854d5be954fbe68bdf6e77873933b484d1e45db12bb2f8cf" dependencies = [ "aes", "aes-gcm", @@ -5324,9 +5333,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "1.4.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" +checksum = "88ad59a7560b41a70d191093a945f0b87bc1deeda46fb237479708a1d6b6cdfc" dependencies = [ "getrandom 0.2.10", "serde", @@ -5507,10 +5516,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] -name = "windows" -version = "0.48.0" +name = "windows-core" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" dependencies = [ "windows-targets 0.48.5", ] diff --git a/Cargo.toml b/Cargo.toml index 1293d3be1..c9fb1a0f7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -61,6 +61,6 @@ rand_distr = "0.4.1" clap = { version = "4.0.4", features = ["cargo", "derive"] } async-trait = "0.1.30" typetag = "0.2.5" -aws-throwaway = "0.2.0" +aws-throwaway = "0.3.0" tokio-bin-process = "0.4.0" ordered-float = { version = "4.0.0", features = ["serde"] } diff --git a/ec2-cargo/src/main.rs b/ec2-cargo/src/main.rs index 6efa52e85..bd922b350 100644 --- a/ec2-cargo/src/main.rs +++ b/ec2-cargo/src/main.rs @@ -92,7 +92,10 @@ else fi "#).await; while let Some(line) = receiver.recv().await { - println!("{}", line) + match line { + Ok(line) => println!("{line}"), + Err(err) => panic!("Failed to setup instance: {err:?}"), + } } println!("Finished creating instance."); @@ -151,7 +154,10 @@ cargo nextest run {} 2>&1 )) .await; while let Some(line) = receiver.recv().await { - println!("{}", line) + match line { + Ok(line) => println!("{line}"), + Err(err) => println!("{err:?}"), + } } Ok(()) @@ -176,7 +182,10 @@ cargo windsock {} 2>&1 )) .await; while let Some(line) = receiver.recv().await { - println!("{}", line) + match line { + Ok(line) => println!("{line}"), + Err(err) => println!("{err:?}"), + } } rsync_fetch_windsock_results(state).await; diff --git a/shotover-proxy/benches/windsock/aws/mod.rs b/shotover-proxy/benches/windsock/aws/mod.rs index 5021673c8..2c693bb2a 100644 --- a/shotover-proxy/benches/windsock/aws/mod.rs +++ b/shotover-proxy/benches/windsock/aws/mod.rs @@ -216,9 +216,14 @@ sudo docker system prune -af"#, loop { match tokio::time::timeout(Duration::from_secs(120), receiver.recv()).await { Ok(Some(line)) => { - writeln!(logs, "{}", line).unwrap(); - if regex.is_match(&line) { - return; + match line { + Ok(line) => { + writeln!(logs, "{line}").unwrap(); + if regex.is_match(&line) { + return; + } + } + Err(err) => panic!("docker logs failed: {err:?}"), } } Ok(None) => panic!( @@ -287,7 +292,7 @@ RUST_BACKTRACE=1 ./shotover-bin --config-file config.yaml --topology-file topolo tokio::select! { line = receiver.recv() => { match line { - Some(line) => { + Some(Ok(line)) => { let event = Event::from_json_str(&line).unwrap(); if let Level::Warn = event.level { tracing::error!("shotover warn:\n {event}"); @@ -299,6 +304,7 @@ RUST_BACKTRACE=1 ./shotover-bin --config-file config.yaml --topology-file topolo return } } + Some(Err(err)) => panic!("shotover-bin failed: {err:?}"), None => return, } }, diff --git a/shotover-proxy/benches/windsock/profilers.rs b/shotover-proxy/benches/windsock/profilers.rs index 1419e8119..c84a031fd 100644 --- a/shotover-proxy/benches/windsock/profilers.rs +++ b/shotover-proxy/benches/windsock/profilers.rs @@ -1,5 +1,6 @@ use self::samply::Samply; use crate::common::Shotover; +use anyhow::Result; use aws_throwaway::Ec2Instance; use perf_flamegraph::Perf; use std::{collections::HashMap, path::PathBuf}; @@ -19,7 +20,7 @@ pub struct ProfilerRunner { results_path: PathBuf, perf: Option, samply: Option, - sys_monitor: Option>, + sys_monitor: Option>>, } impl ProfilerRunner { @@ -98,7 +99,7 @@ impl Drop for ProfilerRunner { pub struct CloudProfilerRunner { bench_name: String, - monitor_instances: HashMap>, + monitor_instances: HashMap>>, } impl CloudProfilerRunner { diff --git a/shotover-proxy/benches/windsock/profilers/sar.rs b/shotover-proxy/benches/windsock/profilers/sar.rs index baa3d3820..9b8b854ef 100644 --- a/shotover-proxy/benches/windsock/profilers/sar.rs +++ b/shotover-proxy/benches/windsock/profilers/sar.rs @@ -1,5 +1,6 @@ //! This module provides abstractions for getting system usage from the unix command `sar`, on ubuntu it is contained within the package `sysstat`. +use anyhow::Result; use aws_throwaway::Ec2Instance; use std::{collections::HashMap, process::Stdio}; use time::OffsetDateTime; @@ -110,7 +111,7 @@ fn metric_with_formatter String>( /// 12:19:52 kbmemfree kbavail kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty /// 12:19:53 10827924 17655248 14426872 43.97 482592 6566224 20441924 62.30 13649508 7304056 148 /// ``` -pub fn parse_sar(rx: &mut UnboundedReceiver) -> ParsedSar { +pub fn parse_sar(rx: &mut UnboundedReceiver>) -> ParsedSar { let mut named_values = HashMap::new(); // read date command @@ -121,7 +122,7 @@ pub fn parse_sar(rx: &mut UnboundedReceiver) -> ParsedSar { }; }; let started_at = - OffsetDateTime::from_unix_timestamp_nanos(started_at.parse().unwrap()).unwrap(); + OffsetDateTime::from_unix_timestamp_nanos(started_at.unwrap().parse().unwrap()).unwrap(); // skip header if rx.try_recv().is_err() { @@ -152,8 +153,9 @@ pub fn parse_sar(rx: &mut UnboundedReceiver) -> ParsedSar { }; }; for (head, data) in header + .unwrap() .split_whitespace() - .zip(data.split_whitespace()) + .zip(data.unwrap().split_whitespace()) .skip(1) { named_values @@ -176,7 +178,7 @@ const SAR_COMMAND: &str = "date +%s%N; sar -r -u 1"; /// Run the sar command on the local machine. /// Each line of output is returned via the `UnboundedReceiver` -pub fn run_sar_local() -> UnboundedReceiver { +pub fn run_sar_local() -> UnboundedReceiver> { let (tx, rx) = unbounded_channel(); tokio::spawn(async move { let mut child = Command::new("bash") @@ -187,7 +189,7 @@ pub fn run_sar_local() -> UnboundedReceiver { .unwrap(); let mut reader = BufReader::new(child.stdout.take().unwrap()).lines(); while let Some(line) = reader.next_line().await.unwrap() { - if tx.send(line).is_err() { + if tx.send(Ok(line)).is_err() { child.kill().await.unwrap(); return; } @@ -199,6 +201,6 @@ pub fn run_sar_local() -> UnboundedReceiver { /// Run the sar command over ssh on the passed instance. /// Each line of output is returned via the `UnboundedReceiver` -pub async fn run_sar_remote(instance: &Ec2Instance) -> UnboundedReceiver { +pub async fn run_sar_remote(instance: &Ec2Instance) -> UnboundedReceiver> { instance.ssh().shell_stdout_lines(SAR_COMMAND).await } diff --git a/shotover/Cargo.toml b/shotover/Cargo.toml index 803999ff7..695409b61 100644 --- a/shotover/Cargo.toml +++ b/shotover/Cargo.toml @@ -76,7 +76,7 @@ ordered-float.workspace = true #Crypto aws-config = "0.56.0" -aws-sdk-kms = "0.30" +aws-sdk-kms = "0.33" strum_macros = "0.25" chacha20poly1305 = { version = "0.10.0", features = ["std"] } generic-array = { version = "0.14", features = ["serde"] }