Skip to content

feat: per-provider availability + slack alerts on offline/recovered#98

Merged
Flotapponnier merged 1 commit into
mainfrom
feat/provider-availability-alerting
May 23, 2026
Merged

feat: per-provider availability + slack alerts on offline/recovered#98
Flotapponnier merged 1 commit into
mainfrom
feat/provider-availability-alerting

Conversation

@Flotapponnier

Copy link
Copy Markdown
Collaborator

Deux changements liés :

1. Per-provider 'Currently unavailable' UI
Les providers sans data ce cycle (0slot, cardano, harness down) étaient rendus avec p50=0 → rang #1 sur les benches lower-is-better. Maintenant : tag availability='unavailable', ligne triée en bas, affichage 'Currently unavailable' + 'Awaiting next successful scrape', stats helpers les excluent.

2. Slack alerts via Vercel Cron
Nouveau /api/cron/health-check toutes les 5min. Pour chaque provider, query prom 'samples reçus dans les 10 dernières min ?' vs 'idem mais 6 min en arrière'. Le diff (transition up↔down) post sur Slack. Pas de DB externe, prom est la source de vérité.

Setup operator (1 fois):

  • SLACK_WEBHOOK_URL dans Vercel env (production)
  • CRON_SECRET random string (Vercel l'injecte comme Authorization: Bearer auto)

Provider lifecycle

When prom returns null for a provider's p50/p90/p99 queries this cycle,
spec.ts now tags the augmented entry with availability='unavailable'
instead of leaving it as a row of zeros that ranks #1 on lower-is-better
benches (the 0slot / cardano UX bug). LedgerTable renders the row at the
bottom with a soft amber pill 'Currently unavailable' + 'Awaiting next
successful scrape'. Stats helpers (computeFieldStats, rankProviders,
benchmark-body, chain-headings-summary, bench-template, citation) all
exclude unavailable rows so Best/Median/Spread no longer collapse to 0.

Slack alerting

New /api/cron/health-check route. For each live bench it asks prom two
questions per provider: 'did you receive samples in the last 10 min?'
and the same query offset 6 min back. The edge (was-live xor is-live)
triggers a slack post via SLACK_WEBHOOK_URL env. No external state - we
use prom's own series history as the source of truth.

Operator setup (one-time, in Vercel project settings)
  - SLACK_WEBHOOK_URL  : the incoming-webhook url (channel of choice)
  - CRON_SECRET        : random string, used to gate the cron route

vercel.json schedules the route every 5 minutes. Vercel injects the
Authorization: Bearer $CRON_SECRET header automatically.
@Flotapponnier
Flotapponnier merged commit cfecec3 into main May 23, 2026
1 check failed
@Flotapponnier
Flotapponnier deleted the feat/provider-availability-alerting branch May 23, 2026 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant