In short
- An SLO of 99.9% leaves an error budget of 0.1% of requests. The burn rate is how fast you spend it: 1 spends it exactly over the SLO period.
- Page when the budget burns at 14.4x over 1 hour, or 6x over 6 hours; open a ticket at 1x over 3 days. Each rule also needs a short window (5 minutes, 30 minutes, 6 hours) above the same rate, so the alert stops soon after the problem does.
- Monitoring Tool applies these rules to an Express API after npm install @carchalabs/monitoring and one middleware line.
Error budget and burn rate
A service level objective (SLO) says what share of requests must be good, for example 99.9% of requests answer without a server error. What is left, 0.1%, is the error budget: the failures you can afford over the SLO period.
The burn rate is the share of bad requests divided by the budget. With a 99.9% objective, 1.44% of requests failing is a burn rate of 14.4: at that pace a 30-day budget is gone in about two days. Alerting on the burn rate instead of a fixed error percentage ties the alert to how much of your objective is at risk.
Multi-window, multi-burn-rate alerts
The Google SRE Workbook recommends three rules for a 30-day SLO. Each one fires only when both its long window and its short window burn at or above the rate; the short window makes the alert stop shortly after the problem ends.
| Severity | Long window | Short window | Burn rate | Budget spent when it fires |
|---|---|---|---|---|
| Page | 1 hour | 5 minutes | 14.4 | 2% |
| Page | 6 hours | 30 minutes | 6 | 5% |
| Ticket | 3 days | 6 hours | 1 | 10% |
A fast, severe outage trips the 1-hour rule within minutes; a slow leak that would still exhaust the budget trips the 3-day rule and becomes a ticket rather than a page at night.
Set it up for Express
Create an application and an ingest token in the Monitoring dashboard, then add the middleware before your routes. It needs Node.js 22 or later and has no runtime dependencies. Routes come from Express, so /orders/1 and /orders/2 count as one endpoint, /orders/:id.
npm install @carchalabs/monitoring
// app.js
import express from 'express';
import { createMonitor } from '@carchalabs/monitoring';
const monitor = createMonitor({ token: process.env.CARCHALABS_MONITORING_TOKEN });
const app = express();
app.use(monitor.express()); // before your routes
app.get('/orders/:id', (req, res) => res.json({ id: req.params.id }));
const server = app.listen(3000);
process.on('SIGTERM', async () => {
server.close();
await monitor.shutdown(); // sends what is still queued
});Records are sent in the background in batches of up to 100; the middleware never waits for the network. Response bodies are never sent, and authorization, cookie and token headers are replaced by [redacted] before they leave your server.
Create the SLO rule
In the dashboard, add an alert rule for the application, a route or all routes:
- SLO availability: bad requests are those answered with a 5xx status. Set the objective between 90% and 99.99%.
- SLO latency: bad requests are those slower than the latency you set, for example 300 ms.
The rule evaluates the three windows above every minute and fires at the most severe one that matches. It waits for at least 100 requests in the long window by default, so a quiet endpoint does not page on two failures. Threshold rules for latency and error rate, and a no-traffic rule, are there for the cases an SLO does not cover.
Verify the alert webhook
Alerts go by email or to a webhook. A webhook request carries X-LogBadger-Signature: sha256=<hex>, the HMAC-SHA256 of the raw body with the rule's secret. Check it on the raw bytes before parsing, and compare in constant time:
import crypto from 'node:crypto';
import express from 'express';
const app = express();
const secret = process.env.MONITORING_WEBHOOK_SECRET; // the alert rule's secret
app.post('/hooks/monitoring', express.raw({ type: 'application/json' }), (req, res) => {
const expected = 'sha256=' + crypto.createHmac('sha256', secret).update(req.body).digest('hex');
const given = req.get('X-LogBadger-Signature') ?? '';
const ok = given.length === expected.length && crypto.timingSafeEqual(Buffer.from(given), Buffer.from(expected));
if (!ok) return res.sendStatus(401);
const alert = JSON.parse(req.body); // event_id, state, severity, message, rule, application, details, created_at
console.log(alert.state, alert.severity, alert.message);
res.sendStatus(204);
});Try it
The read-only demo shows a dashboard with sample traffic and alert rules, without an account. The product page lists what Monitoring Tool does and where it stops.