Function get_alerts_needing_escalation

Source
pub async fn get_alerts_needing_escalation(
    pool: &Pool<MySql>,
    org_id: Option<i64>,
    hours_threshold: i64,
) -> Result<Vec<Alert>>
Expand description

Retrieves alerts that need escalation based on age and status.

This function identifies alerts that have been active for longer than a specified threshold period without being acknowledged or resolved, which may indicate they need to be escalated to ensure appropriate attention.

§Arguments

  • pool - Database connection pool for executing the query
  • org_id - Optional organization ID to filter alerts
  • hours_threshold - Age in hours after which an alert should be considered for escalation

§Returns

  • Ok(Vec<Alert>) - List of alerts needing escalation
  • Err(anyhow::Error) - Failed to fetch alerts