Sentry — alert on project error-rate spike
After a release Sentry only fires on big incidents. I want to catch a slow error-rate climb over a 15-minute window before it becomes a real incident.
Recipe
#!/usr/bin/env bash
# /opt/sentry-error-rate.sh — runs from cron every 5 min
# Sentry Events API v0 — /api/0/projects/{org}/{proj}/stats/
ORG=${SENTRY_ORG}
PROJ=${SENTRY_PROJECT}
TOKEN=${SENTRY_AUTH_TOKEN}
THRESH=${THRESH:-50} # events / 15-min bucket
NOW=$(date +%s)
SINCE=$((NOW - 900)) # last 15 min
COUNT=$(curl -s -H "Authorization: Bearer $TOKEN" \
"https://sentry.io/api/0/projects/$ORG/$PROJ/stats/?since=$SINCE&until=$NOW&resolution=10s&stat=received" \
| jq '[.[] | .[1]] | add')
if [ "${COUNT:-0}" -gt "$THRESH" ]; then
echo "sentry-spike: $COUNT events in 15min (threshold $THRESH)"
curl -fsS -X POST "$HEARTBEAT_URL" \
-H 'Content-Type: application/json' \
--data "{\"status\":\"down\",\"detail\":\"$COUNT events / 15m\"}"
exit 2
fi
echo "OK ($COUNT events / 15m)"
Same thing in Enterno.io
Wrap this script in an Enterno heartbeat — 30-day retention of error-rate alongside uptime in one dashboard instead of Sentry charts that do not correlate with upstream incidents.
Related recipes
The server starts returning 503/504 — but a plain uptime check misses it because the homepage is 200 while the API path is on fire.
A Worker auto-deploys from main. Once prod 5xx rate jumped to 12% — but dashboards get checked once a day. Want a per-minute probe.
After a release Lighthouse perf score drops from 90 to 65 (new lib without code-split, or un-minified bundle). You only learn when RUM starts showing LCP > 4 s.