diff --git a/backend/src/audit.rs b/backend/src/audit.rs index a291cac3f6..e9da769e51 100644 --- a/backend/src/audit.rs +++ b/backend/src/audit.rs @@ -64,10 +64,7 @@ pub async fn audit_log<'c>( let p_json: serde_json::Value = serde_json::to_value(¶meters).unwrap(); tracing::info!( - username = username, - kind = "audit", operation = operation, - workspace = w_id, action_kind = ?action_kind, resource = resource, parameters = %p_json diff --git a/backend/src/error.rs b/backend/src/error.rs index cbed14d1e2..0fa25c2076 100644 --- a/backend/src/error.rs +++ b/backend/src/error.rs @@ -62,7 +62,7 @@ impl IntoResponse for Error { Self::SqlErr(_) | Self::BadRequest(_) => StatusCode::BAD_REQUEST, _ => StatusCode::INTERNAL_SERVER_ERROR, }; - tracing::error!(status = %status, error = %e, kind = "error"); + tracing::error!(error = e.to_string()); Response::builder() .header("Content-Type", "text/plain") .status(status) diff --git a/backend/src/tracing_init.rs b/backend/src/tracing_init.rs index aca7089ad7..70ba029068 100644 --- a/backend/src/tracing_init.rs +++ b/backend/src/tracing_init.rs @@ -20,8 +20,8 @@ impl OnResponse for MyOnResponse { ) { tracing::info!( latency = %latency.as_millis(), - status = ?response.status(), - "finished processed request") + status = response.status().as_u16(), + "response") } } @@ -34,8 +34,9 @@ impl MakeSpan for MyMakeSpan { "request", method = %request.method(), uri = %request.uri(), - version = ?request.version(), username = field::Empty, + workspace_id = field::Empty, + email = field::Empty, ) } } diff --git a/backend/src/users.rs b/backend/src/users.rs index f0027fe711..c8bd906378 100644 --- a/backend/src/users.rs +++ b/backend/src/users.rs @@ -293,9 +293,15 @@ where }; if let Some(token) = token_o { if let Ok(Extension(cache)) = Extension::>::from_request(req).await { - if let Some(authed) = cache.get_authed(workspace_id, &token).await { + if let Some(authed) = cache.get_authed(workspace_id.clone(), &token).await { req.extensions_mut().insert(authed.clone()); Span::current().record("username", &authed.username.as_str()); + if let Some(email) = authed.email.clone() { + Span::current().record("email", &email.as_str()); + } + if let Some(workspace_id) = workspace_id { + Span::current().record("workspace_id", &workspace_id); + } return Ok(authed); } } diff --git a/backend/src/worker_flow.rs b/backend/src/worker_flow.rs index 9d0ea90c79..3da6b310cc 100644 --- a/backend/src/worker_flow.rs +++ b/backend/src/worker_flow.rs @@ -149,7 +149,7 @@ pub async fn update_flow_status_after_job_completion( .fetch_one(&mut tx) .await?; - tracing::info!("UPDATE: {:?}", new_status); + tracing::debug!("UPDATE: {:?}", new_status); let flow_job = get_queued_job(flow, w_id, &mut tx) .await? diff --git a/backend/src/workspaces.rs b/backend/src/workspaces.rs index 1f3ea24e1d..e6bae4e17f 100644 --- a/backend/src/workspaces.rs +++ b/backend/src/workspaces.rs @@ -346,7 +346,7 @@ async fn create_workspace( "workspaces.create", ActionKind::Create, &nw.id, - Some(&authed.email.unwrap()), + Some(nw.name.as_str()), None, ) .await?;