Monitors
A monitor watches a contract and opens an alert episode when something is wrong. Destinations are notified when an episode opens, escalates and recovers.
There are two kinds.
| Kind | |
|---|---|
| Default monitors | Three checks every watched contract gets. No setup. |
| Custom monitors | A rule you write against a metric, with your own thresholds. |
Metric → Monitor → Healthy | Warning | Alerting → Alert episode → NotificationWarning and Alerting are determined by the value. There is no severity or priority setting.
Default monitors
Default monitors run on every watched contract. Each has one tier, Alerting, and none judges against a fixed number: a default fires on something that changed, or on the contract’s own normal.
| Monitor | Watches | Alerts when | Closes when |
|---|---|---|---|
| Control change | The contract’s owner, proxy admin, implementation, beacon and paused state | The owner or admin changes, the implementation or beacon is upgraded, or the contract is paused or unpaused | A day after the newest change |
| Dependency failure | Calls the contract makes to other contracts, per callee and method, that revert and fail the transaction | At least 2 such failures make up at least half of the calls to that callee and method in the last hour, on a dependency that was working before. A rarely called one is judged over 6 hours | No callee fails that way over its window |
| Revert spike | The share of transactions touching the contract that reverted | The last hour’s rate is above twice the contract’s own rate over the prior week and above 2%, on at least 5 failures in 20 transactions. Needs 6 hours of history first | The rate drops back under the line |
- One monitor of each kind per workspace, covering every watched contract. Each contract gets its own episode.
- Judged every minute. Dependency failure every five minutes. A revert the contract catches is not counted.
- A default notifies every destination, including ones connected later, until narrowed on its page.
- A contract can be excluded from a default, on its page or with
contract.dev monitor exclude. A default can be switched off, not deleted. - A control change is a record, not a condition: its episode is notified once, never reminded, and closes without a recovery message.
Add a monitor
Open Monitoring and select Add monitor.
| Step | |
|---|---|
| Metric | Chain, address, and the value to read. Same picker as tracking a metric; the value is tracked if it isn’t already. Any address is accepted. |
| Thresholds | The alert threshold, and an optional warning threshold on the healthy side of it. |
| Notifications | Destinations. Every connected destination is selected to begin with. A monitor with none selected still opens episodes; it notifies nobody. |
contract.dev monitor add "Treasury · Native balance" --below 25000 --warn 30000 --to telegramRules
| Rule | Alerts when |
|---|---|
Falls below n | metric drops below n |
Rises above n | metric rises above n |
| Falls below metric B | metric A drops below metric B |
| Rises above metric B | metric A rises above metric B |
For rules between two metrics, the warning tier is a percentage margin: reserves >= liabilities with a 5% warning warns when reserves are within 5% of liabilities. Comparisons are exact.
States
| State | |
|---|---|
| Healthy | The latest reading satisfies the rule. |
| Warning | Past the warning threshold, not past the alert threshold. An episode is open. |
| Alerting | Past the alert threshold. An episode is open. |
| No data | The metric has no reading yet. |
| Disabled | Switched off. Not evaluated, no notifications. |
A default monitor’s state is the worst of its contracts’.
Evaluation
Custom monitors evaluate on every new reading of their metric. For balance, supply and function-call metrics, a crossing is re-read at the block it was seen before an episode opens or escalates. Recovery takes effect on the first reading back inside the rule.
Monitoring page
The header shows the healthy, warning and alerting counts. The rail on the left lists watched contracts with their health; select one to narrow the page to it, select it again to widen. The scope is stored in the URL.
| View | |
|---|---|
| Monitors | The default monitors, with the contracts each covers, its reading and when it last fired; then the custom monitors, with state, current value, thresholds, room left before the alert threshold and last trigger. Sort by state; search by name, rule, metric or address. Edit or delete a custom monitor from its row. |
| History | Open and recovered episodes over a window of 24h to 90d, open ones first, then newest first. Filter to open or recovered. Acknowledge inline. An episode that names a transaction opens it in Activity. |
| Destinations | Where alerts are sent. Connect, test and remove destinations. |
Monitor page
A custom monitor’s page: the metric’s chart with thresholds drawn and episodes shaded; state, time healthy, episode count, time alerting and longest episode; the metric, its current value and last sample, the thresholds, the distance to the alert threshold and the last trigger; episode history; destinations; edit, disable, delete. Deleting a monitor deletes its episodes.
A default monitor’s page: the contracts it covers with each one’s state, exclude and include; episode history across them; what it watches and when it alerts; destinations; switch off.
Snooze and disable
Snooze mutes notifications until a set time; evaluation and history continue. Disable stops evaluation. Disable from the monitor page, the Monitors view or the CLI; snooze from the CLI.