Definitions
Catalog
defineCatalog names your providers and task kinds, and sets objectives and production rules.
definitions/catalog/acme.ts
import { defineCatalog } from 'vigie/sdk'
export default defineCatalog({
lateAfterSeconds: 300,
retryLadder: ['1 min', '5 min', '30 min', '2 h', '6 h'],
providers: {
'api.parcelo.dev': 'Parcelo',
'api.paynest.dev': 'Paynest',
'api.postwing.dev': 'Postwing',
},
tasks: {
'parcelo.ship': { integration: 'parcelo', concurrency: 4, handler: 'parcelo/handlers/ship.handler.ts' },
'paynest.scan': { integration: 'paynest', every: '5m', clock: 'Every 5 min' },
'billing.invoices.overdue': { at: '03:00', clock: 'Daily at 03:00' },
},
slos: [
{
id: 'shipping',
name: 'Shipments succeed',
objective: 98,
good: `SELECT sumIf(Attempts, Outcome = 'succeeded') AS v FROM task_1m WHERE Minute >= toDateTime($__from) AND Minute < toDateTime($__to) AND Environment = $__env AND TaskKind = 'parcelo.ship'`,
total: `SELECT sum(Attempts) AS v FROM task_1m WHERE Minute >= toDateTime($__from) AND Minute < toDateTime($__to) AND Environment = $__env AND TaskKind = 'parcelo.ship'`,
},
],
rules: [
{ id: 'checkout-queries', name: 'Checkout runs at most 20 queries', entry: { method: 'POST', route: '/orders/:id/checkout' }, atMost: 20 },
{ id: 'ship-once', name: 'parcelo.ship calls Parcelo once per attempt', entry: { taskKind: 'parcelo.ship' }, host: 'api.parcelo.dev', exactly: 1 },
],
})
| Field | What it does |
|---|---|
providers | Host to name, for External calls and provider health. |
tasks | Per task kind: its integration, schedule (every, at, clock), concurrency, serial key, feature switch, and handler file for "open in code". |
lateAfterSeconds | A due task waiting longer than this counts as late. |
retryLadder | The delays your queue retries with, shown on each run. |
slos | An objective in %, from a good and a total query. Burn rate shows on Overview. |
rules | Production rules checked on real traffic: at most N queries, or exactly N calls to a host, per request or task. Breaches show on Rules. |
defineSlo and defineRule add one at a time, from any file.