Meters
How reported usage events become a billable quantity for the period.
A meter turns a stream of usage events into a billable quantity. It watches one event type and aggregates its events into a running total per billing period; at period end, the plan's charge model prices that total.
What a meter defines
- Aggregation:
sumadds up the events' quantities;countcounts the events and ignores their quantities. - Filter (optional): property values the events must equal, for example only events where
methodequalsPOST. When a filter names several properties, an event must match all of them. There is no "one of" match, so to meter several values, use one meter per value. One event stream can feed several meters with different filters. - Reusable: a meter is defined once and can serve many plans.
Event types Bolt supports today
Every event names an event_type from a Bolt-managed registry, which also validates the event's optional properties:
event_type | Kind | Properties |
|---|---|---|
api_calls | Counter | method (HTTP method), route |
tokens_used | Counter | model |
storage_gb_delta | Gauge, signed deltas | none |
Counters accumulate consumption and reject negative quantities. storage_gb_delta is a gauge: each event is a signed change to a storage level, so negative quantities are valid. Properties are optional; a meter with no filter bills the event regardless of them.
The registry is managed by Bolt and an event type's schema never changes once shipped. If your usage does not fit an existing event type, contact Bolt.
Example
To bill write requests separately from reads, define two meters on the same api_calls stream:
- Write calls: one meter per method, each
sumoverapi_callswith filtermethodequalsPOST,PUT,PATCH, orDELETE. - Read calls:
sumoverapi_calls, filtermethodequalsGET.
Attach each meter to a plan with its own charge model, and one event feed prices the two kinds of traffic differently.