Engineering7 min read
Designing a meter: what to count, and what to leave out
A good meter maps to the value a customer feels, survives retries and is boring to audit. Here is the checklist we use with every new customer.
Every usage based business eventually discovers that the meter is the product. Customers do not read your pricing page twice, but they read every invoice. If the thing you count does not match the value they feel, no amount of discounting will fix the conversation.
Start from the value, not the log line
The easiest meter is whatever your service already logs: requests, rows, seconds of compute. The best meter is the unit your customer would use to describe their own success.
| Product | Easy meter | Better meter |
|---|---|---|
| Email API | API calls | Emails delivered |
| Vector database | Queries | Stored vectors, plus queries above a free allowance |
| Video platform | Bytes egressed | Minutes watched |
A better meter is usually a little harder to compute. That cost is paid once by you instead of every month by your customer.
If a customer cannot predict next month's bill from their own dashboard, the meter is wrong.
Four properties of a meter that lasts
- Monotonic. It only goes up within a period, or it is a gauge you sample at a fixed time.
- Idempotent. Every event has a key, so retries never double count.
- Attributable. Each event names a customer and, ideally, a project or seat inside that customer.
- Replayable. You keep the raw events long enough to rebuild any invoice from scratch.
What it looks like in code
await tessera.events.ingest({
customer: "cus_8f2a",
meter: "emails.delivered",
value: 1,
idempotencyKey: message.id,
timestamp: message.deliveredAt,
});
The idempotency key is the message id, not a random value. That way the same delivery reported by two workers still counts once.
What to leave out
- Internal retries. Count the outcome, not the attempts.
- Free actions. If you will never charge for it, do not meter it. It only adds noise to the invoice.
- Anything you cannot explain in one sentence. If support cannot explain it, sales will discount it.
Pick one meter, ship it, and add a second only when a real customer asks why two very different workloads cost the same.