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