> ## Documentation Index
> Fetch the complete documentation index at: https://acm-aa28ebf6.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Monitoring

> Monitor the SuperBox Cloudflare Worker with wrangler tail and the Workers dashboard

## Live log streaming

The fastest way to see what the Worker is doing is `wrangler tail`:

```bash theme={null}
wrangler tail superbox-executor --format pretty
```

This streams real-time logs from all Worker invocations - requests, errors, console output from the Durable Object, and uncaught exceptions.

<Tip>
  Stop streaming with `Ctrl+C`. Logs are also retained for 24 hours in the Cloudflare dashboard under **Workers & Pages > superbox-executor > Logs**.
</Tip>

## Filtering logs

```bash theme={null}
# Show only errors
wrangler tail superbox-executor --status error

# Filter by IP address
wrangler tail superbox-executor --ip 1.2.3.4

# Compact JSON output (pipe to jq)
wrangler tail superbox-executor --format json | jq .
```

## Workers Analytics dashboard

1. Open [dash.cloudflare.com](https://dash.cloudflare.com)
2. Navigate to **Workers & Pages > superbox-executor**
3. Open the **Metrics** tab

Key metrics available:

| Metric      | Description                          |
| ----------- | ------------------------------------ |
| Requests    | Total invocations per time period    |
| Errors      | 4xx/5xx responses                    |
| CPU time    | Aggregate compute time (p50/p99)     |
| Duration    | Wall-clock time per invocation       |
| Subrequests | Outbound fetch calls (e.g. R2 reads) |

## Durable Object metrics

Durable Object metrics are under **Workers & Pages > superbox-executor > Durable Objects**:

| Metric               | Description                          |
| -------------------- | ------------------------------------ |
| Active objects       | Current live DO instances (sessions) |
| Requests             | DO request rate                      |
| Errors               | DO-level errors                      |
| Storage reads/writes | (Not used - in-memory only)          |

## R2 request metrics

Under **R2 > superbox-mcp-registry > Metrics**:

| Metric             | Description              |
| ------------------ | ------------------------ |
| Class A operations | `PUT`, `DELETE` (writes) |
| Class B operations | `GET`, `LIST` (reads)    |
| Stored bytes       | Total registry size      |

## Alerting

Configure alerts in **Notifications** (Cloudflare dashboard > Notifications):

* **Worker error rate spike** - triggers when error rate exceeds a threshold
* **Worker CPU time exceeded** - triggers on high compute cost per invocation

For critical alerts, use [Cloudflare's webhook notifications](https://developers.cloudflare.com/notifications/get-started/) to send to Slack or PagerDuty.

## Debugging a failed request

1. Get the `cf-ray` header from the failed response
2. Search for it in `wrangler tail` output or the Logs tab in the dashboard
3. Identify the error type:

* `R2Error` - R2 bucket access issue (check credentials)
* `DO error` - Durable Object exception (check server code)
* `401` - Invalid or missing Firebase JWT
* `504` - Worker CPU time limit exceeded (30 ms burst limit on free tier)
