Set up monitoring
Goal
Know the deployed system is alive and behaving — and get told when it isn't — using the primitives Spine already ships.
Prerequisites
- A deployed environment (see Declare your environments).
- A scoped API key for the monitor identity — monitoring needs an authenticated principal (anonymous requests get 401), so mint a dedicated read-only key rather than reusing a human's.
What Spine gives you — and what it doesn't
| Signal | Surface | ||
|---|---|---|---|
| Liveness + config | GET /api/system?action=health → healthy/degraded/unhealthy (DB connectivity only — see caveat below); ?action=manifest → integrity/version fields (partially stale — see caveat) | ||
| Event trail | logs — `/api/logs?action=search | stats | account` and the admin Logs page |
| Automation health | pipeline_executions (status failed), deliveries (failed/retrying webhook deliveries) | ||
| In-app alerts | notifications — pipeline stages can notify people/roles inside the app |
Not shipped: threshold alerting. The alerts entity page documents the intended threshold_alert type, but nothing evaluates it — the old evaluator was a dead path and has been removed (see alerts.md). Don't build a monitor that expects threshold.breached events; the mechanisms below are the real ones.
Steps
External liveness probe. Point an uptime check at the health endpoint:
curl -H "x-api-key: $SPINE_MONITOR_KEY" "$BASE_URL/api/system?action=health"Anything that can poll an HTTPS endpoint works — an uptime service, a cron + curl, or a scheduled check in your own infra. Treat non-200,
degraded, orunhealthyas alert-worthy. Reliability caveat (reference/functions/system.md):healtheffectively proves database connectivity — itsmigrationsandfunctionsdata come from stalev2-core/paths that don't exist, somigrations.pendingis always0/currentalwaystrue, andintegrity.verifiedonly means.spine-manifest.jsonwas readable, not that hashes were checked.?action=manifest'sversionfalls back to'2.0.0'and its migration counts readschema_migrations, not_spine_migrations. Do not use the manifest endpoint as a "did the deploy land" check or a release gate — use your deploy system ornpx spine-framework migrations statusfor that.Failure review on a schedule. The runtime surfaces answer "is anything quietly failing":
GET /api/logs?action=search(oraction=stats) for error-volume spikes —emitLogwrites every auth event, trigger fire, and audit entry here.GET /api/deliveriesfiltered to failed/retrying rows — outbound webhooks that aren't landing.pipeline_executionswithstatus: failed— automation that ran and lost. Via API ornpx spine-framework pipelines executions <id>. Roll this into a periodicspine-operatehealth pass (it automates this loop) or a small scheduled script writing to your own alerting.
- In-app notifications for business events. Where a person should see that something happened, use the
notificationsentity from a pipeline stage — that's in-app signaling, wired the same way as any other automation (seenotifications.mdandadd-a-pipeline.md). - Write it into the ladder. Add the probe URL, the monitor key's scope, and the review cadence to the project's runbook/
AGENTS.mdnotes so the next operator finds them.
Verify
- Kill the key or break the URL → the external probe reports down.
system healthon a healthy deploy returnshealthy—integrity.verified: trueonly means the manifest file was readable, per the caveat above.- A deliberately failed pipeline execution shows up in the failure review.
Common mistakes
- Monitoring anonymously —
/api/*requires a resolved principal; a probe without credentials sees 401s, not health. - Expecting
threshold_alertto fire — unimplemented; use external thresholding on the probe output instead. - Over-monitoring logs —
logsretention is finite: system-cron deletes rows older than a fixed 30 days in its UTC-midnight tick (cleanup_old_logswithp_retention_days: 30— there is nosettings.log_retention_days;accounts.logs_retention_days/observability_retention_daysexist but nothing invokesprune_logs/prune_observability). It's an audit trail, not a metrics store. Export if you need history. - Alerting on everything —
deliveriesretries are normal; alert on terminalfailedstates and sustained error rates, not single retries.
Reference
- Observability — the three runtime surfaces in depth.
- Alerts — what the (unimplemented) threshold model was meant to be.
- Logs · Deliveries · Pipeline executions — the queryable entities.