- ERROR_UNEXPECTED_TOTAL: global unexpected error counter - ERROR_UNEXPECTED_INGEST/QUERY/CONTEXT: per-endpoint unexpected errors - All 500 error paths now increment unexpected counter - Error logs include user_id for customer association: tracing::error!(user_id = claims.sub, "Unexpected error: ...") - Covers: DB errors, search failures, temporal query failures - 515 tests passing
This commit is contained in:
@@ -581,7 +581,9 @@ async fn execute_ingest(
|
||||
HttpResponse::Accepted().json(response)
|
||||
}
|
||||
Err(e) => {
|
||||
tracing::error!("DB error: {}", e);
|
||||
crate::metrics::ERROR_UNEXPECTED_INGEST.inc();
|
||||
crate::metrics::ERROR_UNEXPECTED_TOTAL.inc();
|
||||
tracing::error!(user_id = body.project.as_str(), "Unexpected DB error during ingest: {}", e);
|
||||
HttpResponse::InternalServerError().json(json!({"error": "database_error"}))
|
||||
}
|
||||
}
|
||||
@@ -905,7 +907,9 @@ pub async fn query_handler(
|
||||
match query_temporal_graph(&state, ¶ms).await {
|
||||
Ok(response) => HttpResponse::Ok().json(response),
|
||||
Err(e) => {
|
||||
tracing::error!("Temporal graph query failed: {}", e);
|
||||
crate::metrics::ERROR_UNEXPECTED_QUERY.inc();
|
||||
crate::metrics::ERROR_UNEXPECTED_TOTAL.inc();
|
||||
tracing::error!(user_id = claims.sub.as_str(), "Unexpected error: temporal graph query failed: {}", e);
|
||||
HttpResponse::InternalServerError().json(json!({"error": "query_failed", "reason": e.to_string()}))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user