GraphQL — alert on schema breaking changes
API gateway deploys a new schema — the mobile team learns that a type was removed via the crash reporter. Want a snapshot every 5 min with a diff alert.
Recipe
#!/usr/bin/env bash
# Pulls introspection schema, compares to previous snapshot.
ENDPOINT="${ENDPOINT:?must be set}"
SNAP="${SNAP:-/var/lib/enterno/graphql-schema.json}"
mkdir -p "$(dirname "$SNAP")"
CUR=$(curl -sS -X POST "$ENDPOINT" \
-H "Content-Type: application/json" \
-d '{"query":"{__schema{types{name fields{name type{name}}}}}"}' \
| python3 -c 'import json,sys; print(json.dumps(json.load(sys.stdin), sort_keys=True))')
[ -z "$CUR" ] && { echo "no-schema"; exit 1; }
if [ -f "$SNAP" ]; then
PREV=$(cat "$SNAP")
if [ "$PREV" != "$CUR" ]; then
echo "$CUR" > "$SNAP"
DIFF=$(diff <(echo "$PREV") <(echo "$CUR") | head -20 | tr '\n' ' ')
echo "drift $DIFF"
exit 1
fi
fi
echo "$CUR" > "$SNAP"
echo "ok"
Same thing in Enterno.io
Endpoint + Enterno monitor every 5 min with "ok" keyword = paged on any breaking change. Pair with an API-latency monitor to catch response-time regressions on the same probe.
Related recipes
Stripe, GitHub, Twilio return X-RateLimit-Remaining in response headers. If the backend does not track the floor, you get a sudden 429 and billing stops.
Ensure your site returns 2xx every minute, alert to Slack/Telegram on failure.
Minimal script that checks an SSL certificate and alerts 14 days before expiry.