Alert Conditions

Configure sophisticated alert conditions using operators, thresholds, and statistical analysis.

Condition Operators

OperatorSymbolExample
Greater than>revenue > 100000
Greater or equal>=users >= 1000
Less than<conversion_rate < 0.02
Less or equal<=error_count <= 5
Equal=status = 0
Not equal!=row_count != 0
BetweenBETWEENscore BETWEEN 80 AND 100

Threshold Conditions

{
  "type": "threshold",
  "condition": {
    "operator": "<",
    "value": 10000
  }
}

// BETWEEN example
{
  "type": "threshold",
  "condition": {
    "operator": "BETWEEN",
    "value": [5000, 15000]  // Alert if outside this range
  }
}

Anomaly Detection

Anomaly detection uses Z-score analysis to identify unusual values:

{
  "type": "anomaly",
  "condition": {
    "sensitivity": "medium",  // low, medium, high
    "min_samples": 30,        // Minimum historical data points
    "lookback_period": "30d"  // Historical period for baseline
  }
}

// Sensitivity thresholds:
// low: Z-score > 3.0 (very unusual)
// medium: Z-score > 2.5
// high: Z-score > 2.0 (more sensitive)

Trend Conditions

{
  "type": "trend",
  "condition": {
    "direction": "down",       // up, down, either
    "percent_change": 20,      // Minimum % change to trigger
    "comparison_period": "1w"  // Compare to 1 week ago
  }
}

// Example: Alert when revenue drops more than 15% compared to last week
{
  "type": "trend",
  "metric_id": "weekly_revenue",
  "condition": {
    "direction": "down",
    "percent_change": 15,
    "comparison_period": "1w"
  }
}

Freshness Conditions

{
  "type": "freshness",
  "asset_id": "bronze_orders",  // Table or data asset
  "condition": {
    "max_age_hours": 6          // Alert if data older than 6 hours
  }
}

// Check freshness based on a timestamp column
{
  "type": "freshness",
  "asset_id": "silver_customers",
  "condition": {
    "max_age_hours": 24,
    "timestamp_column": "updated_at"
  }
}

Combining Conditions

Use multiple conditions with AND/OR logic:

{
  "name": "Critical Revenue Alert",
  "conditions": {
    "operator": "AND",
    "rules": [
      {
        "type": "threshold",
        "metric_id": "daily_revenue",
        "condition": {"operator": "<", "value": 5000}
      },
      {
        "type": "trend",
        "metric_id": "daily_revenue",
        "condition": {"direction": "down", "percent_change": 30}
      }
    ]
  }
}