Track Metrics
Record on-chain values as metrics. Metrics are what monitors read.
Requires contract.dev login. Any address is accepted.
track <address> <kind>
contract.dev track <address> <kind> [--chain <id>] [--label "<name>"] [kind flags]| Kind | Reads | Kind flags |
|---|---|---|
native-balance | The address’s native balance | |
erc20-balance | The address’s balance of a token | --token <addr> |
total-supply | An ERC-20’s totalSupply() | |
balance-of | An ERC-20’s balanceOf(holder) | --holder <addr> |
function | The result of any view call | --function "<sig>" [--args a,b] [--word <n>] [--signed] [--decimals <n>] — or --calldata 0x… in place of --function/--args |
tvl | The contract’s TVL in USD | |
calls · reverts · revert-rate · callers · gas-p95 | Method telemetry over a trailing window | [--method <selector|"sig">] [--window 5m|15m|1h|6h|24h] [--only a,b | --except a,b] |
| Flag | Description |
|---|---|
--chain <id|name> | Chain the address lives on, by id or name. Default: 1. |
--label "<name>" | The metric’s name, used by alerts and monitor add. |
--function "<sig>" | A Solidity signature including the return type, e.g. "totalAssets() returns (uint256)". |
--args a,b | Call arguments, comma-separated. Numbers accept 1e18. |
--word <n> | Which return value to record when the function returns several. |
--signed | Decode the result as a signed integer. |
--decimals <n> | Display scale. Divides the raw value in charts and alerts. |
--method | For the method kinds: one function by selector or signature. Omit for every call to the contract. |
--window | For the method kinds: the trailing window each sample sums over. Default 1h. |
--only / --except | For the method kinds: count only calls from these addresses, or from anyone except them. |
contract.dev track 0xA0b8… total-supply --label "USDC supply"
contract.dev track 0xVault… function --function "totalAssets() returns (uint256)" --decimals 18 --label "Vault assets"
contract.dev track 0xVault… function --function "convertToAssets(uint256) returns (uint256)" --args 1e18 --decimals 18 --label "Share price"
contract.dev track 0xPool… revert-rate --method "swap(address,bool,int256,uint160,bytes)" --window 15m
contract.dev track 0xVault… calls --method "pause()" --except 0xMultisig… --window 5m --label "pause() from outside the multisig"Tracking Vault assets on chain 1 (id: cmfyzq1e20003pqrs…)Tracking a value that is already tracked returns the existing metric (Already tracking …) instead of a second one.
The method kinds are available on Ethereum, Arbitrum, Avalanche and Sepolia.
metrics
List the workspace’s tracked metrics.
contract.dev metrics # everything: id, kind, chain, address, label, value
contract.dev metrics --address 0xVault… # one address
contract.dev metrics --chain 43114 # one chainmetrics show <id|label>
One metric’s current value and its recent readings.
contract.dev metrics show "Vault assets" --range 7d --limit 20Vault assets (cmfyzq1e20003pqrs…)
kind: functionResult chain: 1 address: 0xVault…
value: 31,204.118 last change: 2026-09-20T08:51:03.000Z
history (7d): 412 points, showing the last 20
2026-09-20T08:51:03.000Z 31,204.118 block 23456789 0xabc…
…| Flag | Description |
|---|---|
--range | 24h, 7d, 30d, 90d or all. |
--limit <n> | How many readings to print, newest last. |
metrics export <id|label>
The metric’s history, one row per reading, as CSV (default) or JSON.
contract.dev metrics export "Vault assets" --range 90d > vault-assets.csv
contract.dev metrics export "Vault assets" --format jsonat,value,block,tx
2026-09-20T08:51:03.000Z,31204.118,23456789,0xabc…
2026-09-20T09:03:11.000Z,31198.002,23456851,0xdef…| Flag | Description |
|---|---|
--range | 24h, 7d, 30d, 90d or all (default). |
--format | csv (default) or json. |
The newest 2,000 readings of the range are exported.
Manage a metric
contract.dev metrics rename <id|label> "<label>"
contract.dev metrics pause <id|label> # stop sampling, keep history
contract.dev metrics resume <id|label>
contract.dev metrics decimals <id|label> <n|clear>Changing decimals re-scales the stored history for display. Monitors on the metric compare against the new scale.
metrics track … and metrics untrack … are accepted as well as track and untrack.
untrack <id|label>
Stop tracking. Deletes the metric’s history and any monitors that read it.
contract.dev untrack "Vault assets"Untracked Vault assets (cmfyzq1e20003pqrs…) — its history and any monitors reading it are gone.