Policy Patterns
Choose policy aggregates based on the raw event shape.
| Stream shape | Example | Good aggregates | Avoid |
|---|---|---|---|
| count increment | tool.errors.count | sum, count | average |
| latency sample | task.duration_ms | average, p95_est, p99_est | sum |
| additive usage | tokens.used | sum | average |
| binary signal | heartbeat.missed.count | sum, count | average |
Count, error count, and usage events
Usually use sum.
Examples:
tool.errors.countwithsum > 5inhourheartbeat.missed.countwithsum > 0indaytokens.usedwithsum > 50000inhour
Duration events
Usually use:
averagep95_estp99_estmax
Examples:
task.duration_mswithaverage > 2000inhourtask.duration_mswithp95_est > 5000inday
Value and gauge events
Usually use:
averageminmax
Examples:
market.bitcoin.price_usdwithmax > 120000inhoursentiment.bitcoin.reddit.scorewithaverage < -0.4inhour
When you need explicit comparisons, prefer analytics windows instead of inventing derived event names.
Last updated on