Freshness scores and trends
Use the freshness score and event trend to prioritize services for review. Check the underlying recordings and consumer assertions when deciding whether to refresh a library.
Read the freshness score
Use the freshness score to prioritize services for review. It is an integer from 0 to 100, computed from three weighted signals:
| Component and weight | Calculation |
|---|---|
| Recency · 50% | Time since the last recording for the service. The contribution decays from 50 points, halving every 7 days. |
| Coverage · 25% | log10(distinct routes + 1), capped at full credit. Around ten distinct route patterns recorded earns full coverage. |
| Open drift · 25% | an inverted penalty on unacknowledged drift events: zero open events earns full credit, and the component drops to zero at ten or more open events. Acknowledging an event removes its drag. |
The score is a triage signal, not a compatibility guarantee or precise SLA. Its dashboard interpretation is green → likely safe, yellow → look, red → re-record now; review the underlying signals and request coverage. A service with no recordings at all reports 0 with a null last_recorded_at — a distinct "no data yet" state, so "never recorded" never masquerades as "zero drift, all good."
The endpoint returns the underlying signals alongside the number, so the dashboard can show why a score is what it is rather than just the value:
curl "http://localhost:8000/v1/drift/freshness-score?service_id=payments" \
-H "X-API-Key: $GHOST_API_KEY"
# {
# "service_id": "payments",
# "freshness_score": 72,
# "last_recorded_at": "2026-06-14T09:14:22+00:00",
# "distinct_routes": 8,
# "open_drift_event_count": 1,
# "computed_inline": false
# }Read path. On a running deployment the score is read from a materialized view refreshed every five minutes by default, so the lookup is constant-time. The API computes the score inline from the base tables when the view is absent, unreadable or has no row for the service. The response shape is identical either way; computed_inline identifies the path. Between refreshes, the cached score reflects the last refresh.Read the 30-day trend
The sparkline endpoint returns a 30-day, per-day histogram of drift events split by severity — the data behind the small trend cell next to each service on the dashboard's drift table.
curl "http://localhost:8000/v1/drift/sparkline?service_id=payments" \
-H "X-API-Key: $GHOST_API_KEY"
# {
# "service_id": "payments",
# "days": [
# { "day": "2026-06-12", "major": 0, "minor": 2, "total": 2 },
# { "day": "2026-06-15", "major": 1, "minor": 0, "total": 1 }
# ]
# }Days with no events are omitted from the payload; the dashboard pads the gaps with zeros so a sparse series still renders as a flat line punctuated by spikes. A flat line of zeros means no drift events in the displayed series. A cluster of major bars is a cue to review the comparisons and recordings; event absence alone does not establish coverage or compatibility.