diff --git a/api/configs/grafana-logs.config.river b/api/configs/grafana-logs.config.river index 596fe783..258f1129 100644 --- a/api/configs/grafana-logs.config.river +++ b/api/configs/grafana-logs.config.river @@ -13,6 +13,9 @@ loki.source.file "logs" { } loki.write "logs" { + external_labels = { + environment = env("ENVIRONMENT"), + } endpoint { url = "https://logs-prod-us-central1.grafana.net/loki/api/v1/push" basic_auth { diff --git a/api/src/handlers/compile.rs b/api/src/handlers/compile.rs index 6e33bfa4..20da3e27 100644 --- a/api/src/handlers/compile.rs +++ b/api/src/handlers/compile.rs @@ -23,7 +23,7 @@ use tracing::{error, info}; pub(crate) const COMPILATION_LABEL_VALUE: &str = "compilation"; -#[instrument] +#[instrument(skip(request_json, _rate_limited, engine))] #[post("/compile", format = "json", data = "")] pub async fn compile( request_json: Json, @@ -43,7 +43,7 @@ pub async fn compile( }) } -#[instrument] +#[instrument(skip(request_json, _rate_limited, engine))] #[post("/compile-async", format = "json", data = "")] pub async fn compile_async( request_json: Json, @@ -55,7 +55,7 @@ pub async fn compile_async( do_process_command(ApiCommand::Compile(request_json.0), engine) } -#[instrument] +#[instrument(skip(engine))] #[get("/compile-result/")] pub async fn get_compile_result(process_id: String, engine: &State) -> String { info!("/compile-result/{:?}", process_id); diff --git a/api/src/handlers/process.rs b/api/src/handlers/process.rs index 6f36968b..95b58c7e 100644 --- a/api/src/handlers/process.rs +++ b/api/src/handlers/process.rs @@ -4,7 +4,7 @@ use rocket::State; use tracing::{info, instrument}; use uuid::Uuid; -#[instrument] +#[instrument(skip(engine))] #[get("/process_status/")] pub async fn get_process_status(process_id: String, engine: &State) -> String { info!("/process_status/{:?}", process_id); diff --git a/api/src/handlers/verify.rs b/api/src/handlers/verify.rs index 6653f073..d104253c 100644 --- a/api/src/handlers/verify.rs +++ b/api/src/handlers/verify.rs @@ -21,14 +21,14 @@ use crate::worker::WorkerEngine; pub(crate) const VERIFICATION_LABEL_VALUE: &str = "compilation"; -#[instrument] +#[instrument(skip(verification_request_json, _rate_limited, engine))] #[post("/verify", format = "json", data = "")] pub async fn verify( verification_request_json: Json, _rate_limited: RateLimited, engine: &State, ) -> Json { - info!("/verify"); + info!("/verify/{:?}", verification_request_json.config); do_verify(verification_request_json.0, &engine.metrics) .await @@ -40,19 +40,19 @@ pub async fn verify( }) } -#[instrument] +#[instrument(skip(_rate_limited, engine))] #[post("/verify-async", format = "json", data = "")] pub fn verify_async( verification_request_json: Json, _rate_limited: RateLimited, engine: &State, ) -> String { - info!("/verify-async",); + info!("/verify-async/{:?}", verification_request_json.config); do_process_command(ApiCommand::Verify(verification_request_json.0), engine) } -#[instrument] +#[instrument(skip(engine))] #[get("/verify-result/")] pub async fn get_verify_result(process_id: String, engine: &State) -> String { info!("/verify-result/{:?}", process_id); diff --git a/api/src/metrics.rs b/api/src/metrics.rs index 1b2c240c..9663467f 100644 --- a/api/src/metrics.rs +++ b/api/src/metrics.rs @@ -102,7 +102,7 @@ pub(crate) fn create_metrics(registry: Registry) -> Result { }) } -#[instrument] +#[instrument(skip(registry))] #[get("/metrics")] pub(crate) async fn metrics(registry: &State) -> String { let metric_families = registry.gather(); diff --git a/api/src/tracing_log.rs b/api/src/tracing_log.rs index 225fcf55..becd1a81 100644 --- a/api/src/tracing_log.rs +++ b/api/src/tracing_log.rs @@ -99,7 +99,7 @@ pub fn filter_layer(level: LogLevel) -> EnvFilter { LogLevel::Off => "off", }; - tracing_subscriber::filter::EnvFilter::try_new(filter_str).expect("filter string must parse") + EnvFilter::try_new(filter_str).expect("filter string must parse") } pub fn init_logger() -> Result<(), CoreError> { @@ -120,7 +120,7 @@ pub fn init_logger() -> Result<(), CoreError> { let log_type = LogType::from(std::env::var("LOG_TYPE").unwrap_or_else(|_| "json".to_string())); let log_level = LogLevel::from( std::env::var("LOG_LEVEL") - .unwrap_or_else(|_| "debug".to_string()) + .unwrap_or_else(|_| "normal".to_string()) .as_str(), );