> ## Documentation Index
> Fetch the complete documentation index at: https://s2.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Metrics

> Query account, basin, and stream metrics with the S2 CLI.

```bash theme={null}
s2 metrics account <METRIC>
s2 metrics basin my-basin <METRIC>
s2 metrics stream s2://my-basin/my-stream <METRIC>
```

| Scope | Metrics |
| - | - |
| `account` | `active-basins`, `account-ops`, `estimated-billable-usage`, `token-activity` |
| `basin` | `storage`, `append-ops`, `read-ops`, `append-throughput`, `read-throughput`, `basin-ops` |
| `stream` | `storage` |

Run `s2 metrics account --help` (or `basin`, `stream`) for a description of each.

### Time range

Without flags, a metric covers the last 30 days. Set either end as a duration before now or as a Unix timestamp in seconds:

```bash theme={null}
s2 metrics account account-ops --start-ago 7d
s2 metrics account account-ops --start-ago 14d --end-ago 7d
s2 metrics account account-ops --start-timestamp 1790812800 --end-timestamp 1793491200
```

When only the end is given, the start is 30 days before it.

### Counts and throughput

Operation counts, throughput and billing are summed over the time range:

```bash theme={null}
s2 metrics basin my-basin append-ops
```

```
start: 2026-10-20T03:10:59Z
end:   2026-11-19T03:10:59Z

          operations
standard           0
express            6
total              6
```

Pass `--interval minute`, `hour` or `day` to see each interval instead of the sum:

```bash theme={null}
s2 metrics basin my-basin append-ops --interval day
```

### Storage

Storage is a point-in-time value, so it is shown as the latest value followed by up to 12 points spread over the time range:

```bash theme={null}
s2 metrics stream s2://my-basin/my-stream storage --start-ago 6h
```

```
start: 2026-11-18T21:11:01Z
end:   2026-11-19T03:11:01Z

metered_size: 6922445 bytes at 2026-11-19T03:12:00Z

time                    bytes
2026-11-18T21:12:00Z  6922445
2026-11-18T21:44:00Z  6922445
...
2026-11-19T03:12:00Z  6922445
12 of 361 points, see -o json for all
```

### Estimated billable usage

```bash theme={null}
s2 metrics account estimated-billable-usage
```

```
start: 2026-10-20T01:44:09Z
end:   2026-11-19T01:44:09Z

Only finalized hours are included, so the most recent usage may be missing.
These estimates are not a final invoice.

dimension                     usd
ops.account              0.031000
ops.basin                0.015080
storage.data             0.063845
...
total                    2.008026
```

Pass `--interval hour` or `day` for the total per interval.

### Access token activity

The most recent use of each given access token, by outcome and source address. It can lag by a couple of minutes.

```bash theme={null}
s2 metrics account token-activity my-token another-token
```

```
    ADDRESS                             LAST ACTIVITY  CONTEXT                USER AGENT
my-token
  denied
    198.51.100.7                        3m 13s ago     network_policy_denied  curl/8.5.0
  accepted
    10.0.1.23 (vpce-0a1b2c3d4e5f67890)  42s ago                               s2-sdk-rust/0.35.1
    203.0.113.10                        2h 1m ago                             s2-cli/0.47.0
```

Denials are listed first. The [network policy](https://s2.dev/docs/concepts/network-policies.md#token-activity) docs explain how to use this to debug denied requests.

### JSON output

`-o json` prints every data point as returned by the [metrics API](https://s2.dev/docs/api/metrics/account.md), for any metric:

```bash theme={null}
s2 metrics account account-ops --interval hour -o json
```

> [card] [Metrics concepts](https://s2.dev/docs/concepts/metrics.md)
>
> Review metric sets, parameters, scopes, and response types.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.