fix(health): 危急值告警查询添加 tracing 错误日志
This commit is contained in:
@@ -191,14 +191,22 @@ pub async fn list_pending_alerts(
|
||||
let total = query
|
||||
.clone()
|
||||
.count(&state.db)
|
||||
.await?;
|
||||
.await
|
||||
.map_err(|e| {
|
||||
tracing::error!(error = %e, %tenant_id, "查询危急值告警总数失败");
|
||||
e
|
||||
})?;
|
||||
|
||||
let items = query
|
||||
.order_by(critical_alert::Column::CreatedAt, sea_orm::Order::Desc)
|
||||
.offset(offset)
|
||||
.limit(limit)
|
||||
.all(&state.db)
|
||||
.await?;
|
||||
.await
|
||||
.map_err(|e| {
|
||||
tracing::error!(error = %e, %tenant_id, "查询危急值告警列表失败");
|
||||
e
|
||||
})?;
|
||||
|
||||
Ok((items, total))
|
||||
}
|
||||
@@ -211,7 +219,11 @@ pub async fn get_alert(
|
||||
) -> HealthResult<critical_alert::Model> {
|
||||
let alert = critical_alert::Entity::find_by_id(alert_id)
|
||||
.one(&state.db)
|
||||
.await?
|
||||
.await
|
||||
.map_err(|e| {
|
||||
tracing::error!(error = %e, %alert_id, %tenant_id, "查询危急值告警详情失败");
|
||||
e
|
||||
})?
|
||||
.ok_or(HealthError::CriticalAlertNotFound)?;
|
||||
|
||||
if alert.tenant_id != tenant_id {
|
||||
|
||||
Reference in New Issue
Block a user