Skip to product information

Postgres KPI Anomaly Detection with Slack, GitHub & Gmail

Postgres KPI Anomaly Detection with Slack, GitHub & Gmail

 (200+Reviews)
Regular price £28.99
Regular price £28.99 Sale price
SAVE Sold out
⬇
Instant Digital Download
∞
Unlimited Downloads
★
Lifetime Access in Your Account
🔥
128+ Sold
Popular with n8n builders
âš¡
23 people viewing
High interest right now
✅
9 added today
Fast-moving digital product
Postgres KPI Anomaly Detection with Slack, GitHub & Gmail

Postgres KPI Anomaly Detection with Slack, GitHub & Gmail

Regular price £28.99
Regular price £28.99 Sale price
SAVE Sold out

Detect Postgres KPI anomalies and send actionable alerts to Slack, GitHub, and Gmail—automatically

This n8n workflow monitors daily KPI health stored in Postgres, builds robust statistical baselines, detects true anomalies using median/MAD scoring, and routes incident alerts to Slack, GitHub, and Gmail with an OpenRouter (Claude)-generated investigation summary and feedback reporting.

What this workflow does

The workflow is designed for reliable KPI anomaly detection and clear operational routing:

  • Daily ingestion (01:00): Runs on-demand or nightly at 01:00 to load enabled metric definitions from Postgres, execute each metric’s SQL, and store yesterday’s observation in a kpi_observations table.
  • Robust baseline rebuild: Recomputes per-metric baselines in Postgres using a 28-day median and MAD, including day-of-week medians. It logs baseline coverage and posts a Slack warning when history is insufficient to score.
  • Daily anomaly scoring (07:00): At 07:00, it fetches yesterday’s observations joined with baseline and registry settings, then calculates robust z-scores, severity, and skip reasons.
  • Duplicate suppression: Checks recent open/acknowledged incidents in Postgres and enforces a per-run incident cap. Suppressed alerts are logged for auditability.
  • Incident investigation with Claude: For each new incident, creates an incident record in Postgres and uses an OpenRouter (Claude) agent with Postgres and GitHub tools to investigate, validates the explanation against evidence, and updates the incident.
  • Severity-based routing: Sends Slack messages for critical and warning levels, opens a GitHub issue for critical incidents, and triggers a Gmail acknowledgement request. Notification status is recorded back into Postgres.

Use cases

  • Catch abnormal KPI drops/spikes in a production SaaS before they impact customers.
  • Automate incident triage with consistent statistical scoring and duplicate suppression in Postgres.
  • Notify engineering in Slack, create GitHub issues for critical anomalies, and request acknowledgment via Gmail.
  • Provide weekly precision reporting and capture feedback via a webhook.

Technical details

  • Core logic: baseline generation (28-day median, MAD, day-of-week medians) and robust z-score anomaly detection.
  • Integrations / nodes: Slack, GitHub, Gmail, plus workflow control nodes like if, set, code, and merge.
  • Data storage: Postgres tables including kpi_observations and incident/notification status tracking.
View full details