From a88277f83abcc263fd545f05e914df08f4404684 Mon Sep 17 00:00:00 2001 From: Brad Reed Date: Tue, 22 Oct 2024 15:38:55 +0100 Subject: [PATCH] revert some stuff --- metrics/Cargo.lock | 13 +++---------- metrics/Cargo.toml | 1 - metrics/src/logprocessor.rs | 22 ++++++++++------------ metrics/src/main.rs | 4 ++-- 4 files changed, 15 insertions(+), 25 deletions(-) diff --git a/metrics/Cargo.lock b/metrics/Cargo.lock index a956c28..2b44af8 100644 --- a/metrics/Cargo.lock +++ b/metrics/Cargo.lock @@ -30,7 +30,7 @@ dependencies = [ "actix-service", "actix-utils", "ahash", - "base64 0.13.0", + "base64", "bitflags", "brotli", "bytes", @@ -367,12 +367,6 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" -[[package]] -name = "base64" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" - [[package]] name = "bitflags" version = "1.3.2" @@ -1108,7 +1102,6 @@ version = "0.1.7" dependencies = [ "actix-web", "actix-ws", - "base64 0.22.1", "clap", "env_logger", "futures", @@ -1626,7 +1619,7 @@ version = "0.11.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b75aa69a3f06bbcc66ede33af2af253c6f7a86b1ca0033f60c580a27074fbf92" dependencies = [ - "base64 0.13.0", + "base64", "bytes", "encoding_rs", "futures-core", @@ -2051,7 +2044,7 @@ dependencies = [ "async-stream", "async-trait", "axum", - "base64 0.13.0", + "base64", "bytes", "futures-core", "futures-util", diff --git a/metrics/Cargo.toml b/metrics/Cargo.toml index 61ca736..d8b8c03 100644 --- a/metrics/Cargo.toml +++ b/metrics/Cargo.toml @@ -13,7 +13,6 @@ log = "0.4.16" reqwest = { version = "0.11", features = ["json"]} -base64 = "0.22.1" tokio = { version = "1.37", features = ["full"]} actix-web = "4.0.1" actix-ws = "0.3.0" diff --git a/metrics/src/logprocessor.rs b/metrics/src/logprocessor.rs index c1da429..0b17569 100644 --- a/metrics/src/logprocessor.rs +++ b/metrics/src/logprocessor.rs @@ -2,7 +2,6 @@ use log::warn; use serde::Deserialize; use serde_json::{from_str, from_value}; -use base64::prelude::{Engine as _, BASE64_STANDARD_NO_PAD}; use crate::Telemetry; use opentelemetry::{ @@ -202,26 +201,25 @@ pub async fn log_processor(logline: &String, metric_obj: &Telemetry, tracer: &tr handle_http_log(&log,metric_obj).await; } "websocket-log" => { - println!("Got WS log: {}", logline); handle_websocket_log(&log,metric_obj).await; } _ => {} }; //Send log to opentel: - // tracer.in_span("hasura-log", |cx| { - // let span = cx.span(); - // span.add_event( - // logline.clone(), - // vec![], - // ); - // span.set_attribute(KeyValue::new("hasura-timestamp", log.timestamp)); - // span.set_attribute(KeyValue::new("hasura-logtype", log.logtype)); - // }); + tracer.in_span("hasura-log", |cx| { + let span = cx.span(); + span.add_event( + logline.clone(), + vec![], + ); + span.set_attribute(KeyValue::new("hasura-timestamp", log.timestamp)); + span.set_attribute(KeyValue::new("hasura-logtype", log.logtype)); + }); } Err(e) => { warn!("Failed to parse log line: {}", e); - warn!("Line was b64: {}", BASE64_STANDARD_NO_PAD.encode(logline)); + warn!("Line was: {}", logline); } }; } diff --git a/metrics/src/main.rs b/metrics/src/main.rs index 5c49802..1e57e77 100644 --- a/metrics/src/main.rs +++ b/metrics/src/main.rs @@ -193,7 +193,7 @@ async fn main() -> Result<(), Box> { debug!("Configuration: {:?}", config); - // let terminate_rx = signal_handler(); + let terminate_rx = signal_handler(); let metric_obj: Telemetry = Telemetry::new(config.common_labels.clone().unwrap_or_default(),config.histogram_buckets.clone()); let metric_obj = web::Data::new(metric_obj); @@ -202,7 +202,7 @@ async fn main() -> Result<(), Box> { webserver(&config), // logreader::read_file(&tracer, &log_file, &metric_obj, config.sleep_time, terminate_rx.clone()), logreceiver::ws_server(&config, tracer.clone(), metric_obj.clone()), - // collectors::run_metadata_collector(&config, &metric_obj, terminate_rx.clone()) + collectors::run_metadata_collector(&config, &metric_obj, terminate_rx.clone()) ); match res {