Monitoring Views
Three views provide operational visibility without complex queries:| View | Purpose |
|---|---|
v_ai_queue_health | Queue depth by status, avg processing time, oldest queued job |
v_ai_provider_usage | Per-provider call counts, success rates, costs (today/month) |
v_tenant_ai_budget_status | Per-tenant budget usage, remaining budget, percentage used |
Common Tasks
Check queue health
Check provider health
Check tenant budgets
Manually trigger narrative regeneration for a tenant
<tenant_id> with the actual tenant UUID.
Increase a tenant’s monthly budget
Disable AI for a specific tenant
is_enabled = true.
Manually close an open circuit
provider_key values: anthropic, openai, google, groq.
Manually open a circuit (disable a provider)
View recent generation history
Check provider costs today
Failure Modes & Recovery
Worker not running
Symptom: Queue depth keeps growing, no jobs move torunning.
Diagnose:
ai-content-worker cron job is active:
Jobs stuck in running
Symptom: Jobs have status = 'running' for more than 10 minutes.
Diagnose:
ai-reclaim-stuck-jobs cron should handle this automatically every 5 minutes. To manually reclaim:
All providers down
Symptom: All circuits are open, jobs keep failing. Diagnose:- Check each provider’s status page for outages.
- If a provider has recovered, manually close its circuit:
- If all providers are genuinely down, wait — the half-open probe will automatically test recovery every 5 minutes.
Tenant budget exceeded
Symptom: A tenant’s AI content stops updating. Jobs are enqueued but skipped. Diagnose:Content hash dedup is wrong (content not regenerating)
Symptom: Data has changed but the narrative still shows old content. Diagnose:Alerts Reference
| Alert | Trigger | Cron |
|---|---|---|
| Circuit open | Any provider circuit transitions to open | ai-alert-circuit-open (every 5 min) |
| Budget warning | Tenant reaches 80% of monthly budget | ai-alert-budget-warnings (hourly) |
SLACK_WEBHOOK_URL (Edge Function secret). If the webhook is not configured, alerts are silently skipped.