From 1a9d4556fd5e16576bf664994a7f3ffc97571eb6 Mon Sep 17 00:00:00 2001 From: Scott Lyons Date: Tue, 11 Feb 2025 19:07:09 -0800 Subject: [PATCH 1/2] Cleaning up extra fields in traces --- crates/nexus/src/http/dbt/handlers.rs | 4 +-- crates/nexus/src/http/session.rs | 27 +++++++++------------ crates/nexus/src/http/ui/handlers/tables.rs | 2 +- crates/runtime/src/datafusion/planner.rs | 3 +-- 4 files changed, 16 insertions(+), 20 deletions(-) diff --git a/crates/nexus/src/http/dbt/handlers.rs b/crates/nexus/src/http/dbt/handlers.rs index 634ef6966..f6f4580af 100644 --- a/crates/nexus/src/http/dbt/handlers.rs +++ b/crates/nexus/src/http/dbt/handlers.rs @@ -15,7 +15,7 @@ use snafu::ResultExt; use std::io::Read; use uuid::Uuid; -#[tracing::instrument(level = "debug", skip(state), err, ret(level = tracing::Level::TRACE))] +#[tracing::instrument(level = "debug", skip(state, body), err, ret(level = tracing::Level::TRACE))] pub async fn login( State(state): State, Query(query): Query, @@ -56,7 +56,7 @@ pub async fn login( })) } -#[tracing::instrument(level = "debug", skip(state), err, ret(level = tracing::Level::TRACE))] +#[tracing::instrument(level = "debug", skip(state, body), err, ret(level = tracing::Level::TRACE))] pub async fn query( DFSessionId(session_id): DFSessionId, State(state): State, diff --git a/crates/nexus/src/http/session.rs b/crates/nexus/src/http/session.rs index b7ffccf1d..2b6bebebe 100644 --- a/crates/nexus/src/http/session.rs +++ b/crates/nexus/src/http/session.rs @@ -163,21 +163,18 @@ where msg: e.1.to_string(), } })?; - let session_id = match session.get::("DF_SESSION_ID").await { - Ok(Some(id)) => { - tracing::info!("Found session_id: {}", id); - id - } - _ => { - let id = uuid::Uuid::new_v4().to_string(); - tracing::info!("Creating new session_id: {}", id); - session - .insert("DF_SESSION_ID", id.clone()) - .await - .context(SessionPersistSnafu)?; - session.save().await.context(SessionPersistSnafu)?; - id - } + let session_id = if let Ok(Some(id)) = session.get::("DF_SESSION_ID").await { + tracing::debug!("Found DF session_id: {}", id); + id + } else { + let id = uuid::Uuid::new_v4().to_string(); + tracing::debug!("Creating new DF session_id: {}", id); + session + .insert("DF_SESSION_ID", id.clone()) + .await + .context(SessionPersistSnafu)?; + session.save().await.context(SessionPersistSnafu)?; + id }; Ok(Self(session_id)) } diff --git a/crates/nexus/src/http/ui/handlers/tables.rs b/crates/nexus/src/http/ui/handlers/tables.rs index cffb9b81a..d580e12f8 100644 --- a/crates/nexus/src/http/ui/handlers/tables.rs +++ b/crates/nexus/src/http/ui/handlers/tables.rs @@ -366,7 +366,7 @@ pub async fn update_table_properties( (status = 500, description = "Internal server error", body = NexusError) ) )] -#[tracing::instrument(level = "debug", skip(state), err, ret(level = tracing::Level::TRACE))] +#[tracing::instrument(level = "debug", skip(state, multipart), err, ret(level = tracing::Level::TRACE))] pub async fn upload_data_to_table( DFSessionId(session_id): DFSessionId, State(state): State, diff --git a/crates/runtime/src/datafusion/planner.rs b/crates/runtime/src/datafusion/planner.rs index f0b84657b..1b9965e68 100644 --- a/crates/runtime/src/datafusion/planner.rs +++ b/crates/runtime/src/datafusion/planner.rs @@ -67,8 +67,7 @@ where match self.handle_custom_statement(statement.clone()) { Ok(plan) => return Ok(plan), Err(e) => { - // TODO: Tracing - eprintln!("Custom statement parsing skipped: {statement}: {e}"); + tracing::debug!("Custom statement parsing skipped: {} {}", statement, e); } } From 64136e0a7fb33b94d51a30aafa67d33276ce6211 Mon Sep 17 00:00:00 2001 From: Scott Lyons Date: Tue, 11 Feb 2025 22:59:12 -0800 Subject: [PATCH 2/2] Formatting --- crates/nexus/src/http/dbt/handlers.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/crates/nexus/src/http/dbt/handlers.rs b/crates/nexus/src/http/dbt/handlers.rs index 0aeb1fff9..d31badfda 100644 --- a/crates/nexus/src/http/dbt/handlers.rs +++ b/crates/nexus/src/http/dbt/handlers.rs @@ -24,7 +24,6 @@ use std::io::Read; use tracing::debug; use uuid::Uuid; - // TODO: move out as a configurable parameter const SERIALIZATION_FORMAT: &str = "json"; // or "arrow"