mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-08 08:04:25 +00:00
improve logging
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -20,8 +20,8 @@ impl<B> OnResponse<B> 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<B> MakeSpan<B> for MyMakeSpan {
|
||||
"request",
|
||||
method = %request.method(),
|
||||
uri = %request.uri(),
|
||||
version = ?request.version(),
|
||||
username = field::Empty,
|
||||
workspace_id = field::Empty,
|
||||
email = field::Empty,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -293,9 +293,15 @@ where
|
||||
};
|
||||
if let Some(token) = token_o {
|
||||
if let Ok(Extension(cache)) = Extension::<Arc<AuthCache>>::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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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?
|
||||
|
||||
@@ -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?;
|
||||
|
||||
Reference in New Issue
Block a user