diff --git a/Cargo.toml b/Cargo.toml index a160953..50be5d0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,8 +13,6 @@ aws-sdk-kinesis = { version = "1.36", features = ["behavior-version-latest"] } aws-sdk-ssm = "1.40" aws-types="1.3" aws-credential-types = { version = "1.2", features = ["hardcoded-credentials"] } -rusoto_core = "0.48" -rusoto_s3 = "0.48" deadpool-postgres = "0.14" tokio-postgres = { version = "0.7", features = ["with-chrono-0_4"] } tracing = "0.1" @@ -24,7 +22,7 @@ tracing-appender = "0.2" thiserror = "1.0" tokio = { version = "1.39", features = ["full"] } lapin = "2.5" -sysinfo = "0.30" +sysinfo = "0.31" prometheus = "0.13" dashmap = "6.0" toml = "0.8" diff --git a/src/lib.rs b/src/lib.rs index 95b7899..39c0268 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,5 +8,4 @@ pub mod env; pub mod orchestration; pub mod metrics; pub mod parameter_store; -pub mod constants; -mod s3; \ No newline at end of file +pub mod constants; \ No newline at end of file diff --git a/src/metrics.rs b/src/metrics.rs index ce8dd8a..a614608 100644 --- a/src/metrics.rs +++ b/src/metrics.rs @@ -1,6 +1,6 @@ use sysinfo::System; use prometheus::{register_gauge, Gauge}; -use std::sync::{Arc, OnceLock}; +use std::sync::OnceLock; pub fn get_cpu_usage() -> &'static Gauge { static GAUGE: OnceLock = OnceLock::new(); @@ -33,7 +33,7 @@ pub fn get_memory_usage() -> &'static Gauge { pub fn collect(system: &mut System) -> (f64, f64, f64, f64) { system.refresh_all(); - let cpu_usage = system.global_cpu_info().cpu_usage() as f64; + let cpu_usage = system.global_cpu_usage() as f64; let memory_used = system.used_memory() as f64; let memory_total = system.total_memory() as f64; let memory_usage = memory_used / memory_total * 100.0; diff --git a/src/s3.rs b/src/s3.rs deleted file mode 100644 index d13af8d..0000000 --- a/src/s3.rs +++ /dev/null @@ -1,30 +0,0 @@ -use std::sync::Arc; -use aws_credential_types::Credentials; -use aws_sdk_kinesis::{Client, Config}; -use rusoto_core::{Region, HttpClient}; -use rusoto_core::credential::{StaticProvider, ProvideAwsCredentials}; -use rusoto_s3::{S3Client, S3, GetObjectRequest}; -use tokio::io::AsyncReadExt; -use tokio::sync::OnceCell; - -static AWS_S3_CLIENT: OnceCell> = OnceCell::const_new(); - -async fn initialize_data() -> Arc { - let config = crate::config::get_config() - .await; - - let access_key_id = &config.kinesis_stream.node.access_key.clone(); - let secret_access_key = &config.kinesis_stream.node.secret_key.clone(); - let region = &config.kinesis_stream.node.region.clone(); - - let credentials_provider = StaticProvider::new_minimal(access_key_id.to_string(), secret_access_key.to_string()); - let s3_client = S3Client::new_with(HttpClient::new().expect("failed to create request dispatcher"), credentials_provider, region.parse().unwrap()); - - Arc::new(s3_client) -} - -async fn get_client() -> Arc { - AWS_S3_CLIENT.get_or_init(initialize_data) - .await - .clone() -} \ No newline at end of file