Definitions
Alerts
defineAlert watches error rates, latency, tasks, metrics, missing activity or any SQL, every 30 seconds.
definitions/alerts/acme.ts
import { defineAlert } from 'vigie/sdk'
export const checkoutP95 = defineAlert({
id: 'checkout-p95',
name: 'Checkout slow',
family: 'Endpoint',
when: { source: 'route-p95', method: 'POST', route: '/orders/:id/checkout', minRequests: 20 },
above: 2000,
window: '10m',
unit: 'ms',
})
export const noPayments = defineAlert({
id: 'no-payments',
name: 'No payments ingested',
family: 'No activity',
when: { source: 'absence', taskKind: 'paynest.payment.ingest' },
below: 1,
window: '30m',
quiet: { from: '00:00', to: '07:00', timezone: 'Europe/Paris' },
})
What to watch
when.source | Value |
|---|---|
request-error-rate | Share of requests that answered 5xx, in %. |
route-p95 | p95 duration of one route, or of every route. minRequests ignores quiet windows. |
task-failure-rate | Share of failed task attempts, in %, for one kind or all. |
oldest-due | Age of the oldest task waiting for a worker, in seconds. |
absence | Attempts of a task kind. Use with below: 1. |
log-count | Events matching where fields. |
metric | A metric by name, with agg avg, max or latest, and attributes. |
new-error | An error never seen before. |
sql | Any query returning t and v. |
When it fires
| Field | What it does |
|---|---|
above, below | A fixed threshold. |
sigma | Fire when the value is that many standard deviations above its own last 7 days, instead of a fixed threshold. |
window | The time the value is computed over. |
for | How long it has to hold before firing. |
quiet | Hours when it keeps recording but holds the notification until they end. |
notify | One channel by name. Without it, every channel. A name that no longer exists falls back to every channel: an alert never goes silent. |
Alerts that fire within 30 seconds of each other go out as one message, with the errors behind them and what to do. See Alerts and notifications.