# Monitoring & Alerting Setup (AGENTS.md v16.0 - Observability)
# Configure dashboards and alerts

Write-Host "=== MONITORING & ALERTING SETUP ===" -ForegroundColor Green
Write-Host ""

Write-Host "[1/4] Configuring Batch SLA Dashboard..." -ForegroundColor Yellow
Write-Host "  Query: SELECT queue, COUNT(*) as count FROM hangfire.job GROUP BY queue" -ForegroundColor Cyan
Write-Host "  Interval: Every 1 minute" -ForegroundColor Cyan

Write-Host "[2/4] Setting up Data Quality Quarantine Alerts..." -ForegroundColor Yellow
Write-Host "  Trigger: Jobs with retry_classification = 'dq'" -ForegroundColor Cyan
Write-Host "  Action: Telegram notification to #data-quality channel" -ForegroundColor Cyan

Write-Host "[3/4] Configuring Duplicate Detection..." -ForegroundColor Yellow
Write-Host "  Query: SELECT * FROM outbox.outbox WHERE duplicate_detected = true" -ForegroundColor Cyan
Write-Host "  Threshold: Alert if > 10 duplicates in last hour" -ForegroundColor Cyan

Write-Host "[4/4] Model Drift Monitoring..." -ForegroundColor Yellow
Write-Host "  Track: OOS performance vs baseline" -ForegroundColor Cyan
Write-Host "  Alert: If divergence > 2 standard deviations" -ForegroundColor Cyan

Write-Host ""
Write-Host "✅ Monitoring setup ready. Configure alerting service with above queries." -ForegroundColor Green
exit 0
