Skip to content

Commit

Permalink
revert some stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
noisyscanner committed Oct 22, 2024
1 parent caf244d commit a88277f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 25 deletions.
13 changes: 3 additions & 10 deletions metrics/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion metrics/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
22 changes: 10 additions & 12 deletions metrics/src/logprocessor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -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);
}
};
}
4 changes: 2 additions & 2 deletions metrics/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {

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);
Expand All @@ -202,7 +202,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
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 {
Expand Down

0 comments on commit a88277f

Please sign in to comment.