Budgets & Spend Control
Rules and AlertsEnterprise
Notifying people and blocking requests at the points of a cap you choose.
A rule says what happens when spend reaches a point of a cap, such as an email at 80% of the total or a block at 100%. Rules are set in the Rules card of a budget, up to 50 per budget, and a budget's caps only track spend until a rule says what happens at a line.
Kinds of rules
A rule either notifies or blocks:
| Rule | Action | Effect |
|---|---|---|
| Notify | send an email to | Emails a person in the organization once per period. |
| Notify | post to | Sends a webhook to an endpoint once per period. |
| Block | block requests | On the total cap: refuses every request the budget covers until the period resets. |
| Block | block that router | On router caps: refuses the router that crossed its line, while the others keep serving. |
| Block | block that model | On model caps: refuses that model only, while the others keep serving. |
When a rule acts
Each rule watches one cap and acts at a percentage of it:
| Setting | Values |
|---|---|
| Watches | The total cap, each per-router cap, each model cap, or one model's cap. |
| When spend reaches | A percentage of the cap, from 0.01% to 200%. New rules start at 80%. |
| When projected to reach | On the total cap: when the current pace reaches the percentage within a chosen number of minutes, 30 by default, up to a week. |
A projected rule warns before the line is crossed, such as an alert when the total is projected to reach 100% within 60 minutes. A rule can hold several actions, such as an email, a webhook and a block together.
Firing
A notification fires once per period for each subject it watches, such as each router: the rule shows Firing while it delivers, then Fired this period. A delivery that fails shows Fired · failed, and the rule fires again in a later period when spend reaches the line again. A block holds for as long as spend stays over its line, and the rule shows Holding; raising the cap or the period resetting lifts it.
Email notifications
An email notification goes to the address entered on the rule, which belongs to a person active in the organization, with the subject Production API has reached 80% of its budget and a link to the budget. The Rules card offers email and webhook actions when the installation can send them.
Example
A typical set of rules on a monthly budget:
| Rule | Watches | At | Action |
|---|---|---|---|
| 1 | Total cap | 80% | Email the team lead. |
| 2 | Total cap | Projected 100% within 120 minutes | Post to the on-call webhook. |
| 3 | Each per-router cap | 100% | Block that router. |
| 4 | Total cap | 110% | Block requests. |