api-gateway error rate up to 2.4% since yesterday
1.9M requests across 4 Workers in the last 24 hours. api-gateway errors rose from 0.3% to 2.4%, mostly one exception.
Every morning: requests, error rate and CPU time per Cloudflare Worker for the last 24 hours, against the same day last week, with the top exceptions.
What lands on your board
1.9M requests across 4 Workers in the last 24 hours. api-gateway errors rose from 0.3% to 2.4%, mostly one exception.
The Workers dashboard shows one script at a time, and an error rate creeping from 0.2% to 2% looks like a flat line at the scale of the request chart. Exceptions that only hit one route stay invisible until a customer writes in.
The agent queries the GraphQL Analytics API for every Worker on the account, compares the last 24 hours with the same window a week earlier, and pulls the most frequent exception messages from Workers Logs. The card names the Worker that changed and the error behind it.
POST https://api.cloudflare.com/client/v4/graphql with viewer { accounts(filter: {accountTag: $account}) { workersInvocationsAdaptive(limit: 1000, filter: {datetime_geq: $start, datetime_leq: $end}) { sum { requests errors subrequests } quantiles { cpuTimeP50 cpuTimeP99 } dimensions { scriptName status } } } }. Run it for the last 24 hours and for the same 24 hours a week earlier.
Sum requests and errors per scriptName across status values, then error rate = errors / requests. CPU quantiles come back in microseconds; show milliseconds. Flag a Worker whose error rate is above 1% or at least double last week's.
If Workers Logs is on ([observability] enabled = true in the Wrangler config), call POST /accounts/{account_id}/workers/observability/telemetry/keys to see the available fields, then .../telemetry/query for the last 24 hours, filtered to errors and grouped by message. Logs are kept for 7 days.
Totals for the account, then one row per Worker with requests, error rate, CPU p99 and the change against last week. Under the flagged Worker, list its three most frequent exception messages with counts.
With BRIEFKIN_TOKEN set, the agent sends the result as one card that updates in place every run. Without it, you get the report in the chat.
Pick your agent, where the data comes from and how to schedule it; the commands below follow.
One command. It puts the SKILL.md in ~/.claude/skills and in ~/.agents/skills, which Codex, Cursor, Gemini CLI, Copilot CLI and OpenCode read too.
shellcurl -fsSL https://briefkin.dev/skills/cloudflare-workers-errors-and-usage/install | shAsk Claude Code:
promptRun the cloudflare-workers-errors-and-usage skillOr paste the prompt instead of installing:
promptUsing the Cloudflare GraphQL Analytics API (or the Cloudflare API MCP server), query workersInvocationsAdaptive for my account for the last 24 hours and for the same 24 hours one week earlier, with sum { requests errors subrequests }, quantiles { cpuTimeP50 cpuTimeP99 } and dimensions { scriptName status }. For each Worker give requests, error rate (errors / requests), CPU p50 and p99 in milliseconds, and the change against last week. Flag any Worker with an error rate above 1% or double last week's. If Workers Logs is enabled, query the Workers Observability telemetry API for the last 24 hours and list the three most frequent error messages for each flagged Worker, with counts. Read only.Every day at 8:00, from cron on any machine where Claude Code is signed in:
crontab0 8 * * * claude -p "Run the cloudflare-workers-errors-and-usage skill"Add it with crontab -e. A laptop asleep at that time runs it when it wakes if you use launchd or Task Scheduler instead; GitHub Actions works for the API route.
Connect Briefkin once with curl -fsSL https://briefkin.dev/install | sh and every run lands on your board as a report card. How setup works
SKILL.md---
name: cloudflare-workers-errors-and-usage
description: "Every morning: requests, error rate and CPU time per Cloudflare Worker for the last 24 hours, against the same day last week, with the top exceptions. Use when the user asks for this, or when it runs on a schedule."
---
# Cloudflare Workers errors and usage
Every morning: requests, error rate and CPU time per Cloudflare Worker for the last 24 hours, against the same day last week, with the top exceptions.
The Workers dashboard shows one script at a time, and an error rate creeping from 0.2% to 2% looks like a flat line at the scale of the request chart. Exceptions that only hit one route stay invisible until a customer writes in.
The agent queries the GraphQL Analytics API for every Worker on the account, compares the last 24 hours with the same window a week earlier, and pulls the most frequent exception messages from Workers Logs. The card names the Worker that changed and the error behind it.
## Two ways to get the data
Use the API or MCP route when you have an MCP server, a CLI or an API token for the app. Otherwise, if you can drive a browser the user is signed in to (Claude in Chrome, a Playwright or Chrome DevTools MCP server), use the browser route. Say which one you used.
## Route A: API or MCP server
### What you need
- A Cloudflare API token with Account Analytics read access (and Workers Observability read access for the log query) in `CLOUDFLARE_API_TOKEN`, plus the account ID.
- Or the Cloudflare API MCP server at `https://mcp.cloudflare.com/mcp`, which can run the same GraphQL and REST calls.
If something is missing, say what and stop; do not invent numbers.
### Steps
1. **Query Workers metrics** (Cloudflare): `POST https://api.cloudflare.com/client/v4/graphql` with `viewer { accounts(filter: {accountTag: $account}) { workersInvocationsAdaptive(limit: 1000, filter: {datetime_geq: $start, datetime_leq: $end}) { sum { requests errors subrequests } quantiles { cpuTimeP50 cpuTimeP99 } dimensions { scriptName status } } } }`. Run it for the last 24 hours and for the same 24 hours a week earlier.
2. **Compute per Worker**: Sum requests and errors per `scriptName` across `status` values, then error rate = errors / requests. CPU quantiles come back in microseconds; show milliseconds. Flag a Worker whose error rate is above 1% or at least double last week's.
3. **Pull the top exceptions** (Cloudflare): If Workers Logs is on (`[observability] enabled = true` in the Wrangler config), call `POST /accounts/{account_id}/workers/observability/telemetry/keys` to see the available fields, then `.../telemetry/query` for the last 24 hours, filtered to errors and grouped by message. Logs are kept for 7 days.
4. **Report**: Totals for the account, then one row per Worker with requests, error rate, CPU p99 and the change against last week. Under the flagged Worker, list its three most frequent exception messages with counts.
## Route B: the browser
### What you need
- Signed in to the Cloudflare dashboard with a member role that can view Workers analytics and logs for the account (Administrator Read Only is enough).
If something is missing, say what and stop; do not invent numbers.
### Steps
Start at https://dash.cloudflare.com/?to=/:account/workers-and-pages. The user is signed in already; never type passwords or codes, and ask if a sign-in page appears.
1. **Open Workers & Pages for the account**: The URL asks for the account when you have more than one. The overview lists every Worker with its recent request and error counts; note the names, since each one is opened in turn.
2. **Read each Worker's Metrics tab for the last 24 hours**: Open a Worker and its **Metrics** tab. Set the time range to **Previous 24 hours** and read the **Requests** total, the **Errors** total and the **CPU time** chart's P50 and P99. Error rate is errors divided by requests; the chart shows CPU in milliseconds already.
3. **Compare with the same day last week**: Switch the range to **Previous 7 days** and hover the same 24-hour window seven days earlier to read requests and errors there. Flag a Worker whose error rate is above 1% now or at least double what it was a week ago.
4. **Pull the top exceptions from Workers Logs**: For a flagged Worker open its **Logs** tab (it only has data when observability is enabled for that Worker). Set the range to the last 24 hours, filter on `$metadata.error` or the error level, and read the three most frequent messages with their counts from the grouped view.
5. **Report**: Account totals, then one row per Worker with requests, error rate, CPU P99 and the change against last week, and the three top exception messages under each flagged Worker.
Note: The dashboard shows one Worker at a time, so with ten or more Workers this route is slow and the GraphQL route is the better one. Week-over-week numbers read off a hovered chart are approximate. The Logs tab only exists for Workers with observability enabled, and it keeps 7 days.
## The report
- **Account totals**: requests, errors and error rate for the last 24 hours, against the same window last week.
- **Per Worker**: requests, error rate, CPU p50 and p99, and the weekly change.
- **Top exceptions** for any flagged Worker, with counts.
- One line on where to look first.
## Post it to Briefkin
When `BRIEFKIN_TOKEN` is set, or `~/.config/briefkin/env` exists (the installer from https://briefkin.dev/docs writes it), also send the result to the user's Briefkin board as one card. Keep the `item_key` the same on every run so the card updates in place, use a new `event_id` per run, and put today's real numbers in place of the example ones. If the request fails, say so once and carry on.
```bash
[ -n "${BRIEFKIN_TOKEN:-}" ] || . ~/.config/briefkin/env
curl -sS -X POST "${BRIEFKIN_URL:-https://briefkin.dev}/v1/events" \
-H "authorization: Bearer $BRIEFKIN_TOKEN" \
-H "content-type: application/json" \
-d @- <<'JSON'
{
"v": 1,
"event_id": "cloudflare-workers-errors-and-usage/<date of this run, e.g. 2026-10-16>",
"item_key": "cloudflare-workers-errors-and-usage",
"project": "acme",
"source": "Cloudflare Workers errors and usage skill",
"kind": "update",
"title": "api-gateway error rate up to 2.4% since yesterday",
"summary": "**1.9M** requests across 4 Workers in the last 24 hours. **api-gateway** errors rose from 0.3% to **2.4%**, mostly one exception.",
"widget": [
{
"type": "Table",
"props": {
"columns": [
"Worker",
"Requests",
"Error rate",
"CPU p99",
"vs last week"
],
"align": [
"left",
"right",
"right",
"right",
"left"
],
"rows": [
[
"api-gateway",
"1,284,000",
"2.4%",
"18.2 ms",
"errors up from 0.3%"
],
[
"image-resizer",
"412,500",
"0.1%",
"41.0 ms",
"flat"
],
[
"auth-edge",
"168,300",
"0.2%",
"3.1 ms",
"requests +12%"
],
[
"cron-sync",
"1,440",
"0.0%",
"96.4 ms",
"flat"
]
]
}
},
{
"type": "Log",
"props": {
"lines": [
{
"text": "TypeError: Cannot read properties of undefined (reading 'tenantId') x 27,410",
"level": "error"
},
{
"text": "Error: upstream fetch to origin timed out x 2,960",
"level": "warn"
},
{
"text": "Error: KV GET failed: key too long x 446",
"level": "warn"
}
]
}
},
{
"type": "Callout",
"props": {
"text": "The tenantId errors start at 21:40, right after a deploy of api-gateway. Check requests without an X-Tenant header first.",
"tone": "warn"
}
}
]
}
JSON
```
Widgets come from the Briefkin catalog (https://briefkin.dev/v1/catalog). Without a token, just give the user the report.
## Run it on a schedule
Suggested: Every day at 8:00 (`0 8 * * *`). From cron, with the agent signed in on that machine:
```bash
0 8 * * * claude -p "Run the cloudflare-workers-errors-and-usage skill"
# Codex: codex exec, Gemini CLI: gemini -p, Copilot CLI: copilot -p, OpenCode: opencode run
```
Or use the agent's own scheduler (Claude Code routines, Codex automations, Claude or ChatGPT scheduled tasks): https://briefkin.dev/skills/cloudflare-workers-errors-and-usage#schedule
Source: https://briefkin.dev/skills/cloudflare-workers-errors-and-usage
A Cloudflare API token with Account Analytics read access (and Workers Observability read access for the log query) in CLOUDFLARE_API_TOKEN, plus the account ID.
Or the Cloudflare API MCP server at https://mcp.cloudflare.com/mcp, which can run the same GraphQL and REST calls.
https://mcp.cloudflare.com/mcp. In Claude Code run claude mcp add --transport http cloudflare https://mcp.cloudflare.com/mcp, in Codex codex mcp add cloudflare --url https://mcp.cloudflare.com/mcp, and in Cursor add the URL to mcp.json; you then authorize through Cloudflare and choose the permissions to grant. It reaches the whole API through two tools, search to find endpoints and execute to call them (GraphQL analytics queries included), plus a docs tool (docs). The older per-product servers, such as Observability and GraphQL, are deprecated in its favor.Authorization: Bearer. An account token also needs Account Resources: Read so the server can find the account ID.CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID (the names Wrangler uses too) and posts GraphQL queries; wrangler tail <worker> streams live logs when you need to watch an error happen.Create the token with only Account Analytics: Read, Zone Analytics: Read and Workers Scripts: Read on the accounts and zones in the report; with no Edit permissions, execute can't change anything.
The metrics still work, since GraphQL analytics are collected for every Worker. Only the exception messages need logs: add [observability] enabled = true to the Wrangler config and redeploy. With a high-traffic Worker, a head_sampling_rate below 1 keeps log volume down and still shows the common errors.
The GraphQL dataset answers queries of up to a month at a time for dates up to about three months back, so a week-over-week comparison is well within range. Workers Logs keep 7 days, so exception messages only cover the last week.
No. The skill runs with your own agent and gives you the report in the chat. With a Briefkin token set, each run also posts it to your board as a report card, so you can glance at it instead of asking again.
Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot CLI, OpenCode, Windsurf and Amp all read SKILL.md files. The install command puts it in ~/.claude/skills and ~/.agents/skills, where they look. ChatGPT, the Claude app and Grok take the prompt instead. Pick your agent under "Install and run it" and the commands change to match.
Yes. Switch the data source to "Your browser" and the steps change to the Cloudflare pages themselves: the agent opens dash.cloudflare.com/?to=/:account/workers-and-pages in a browser you are signed in to and reads the numbers off the page. Claude Code, Codex, Cursor, Claude app and ChatGPT can drive a browser out of the box; Gemini CLI, Copilot CLI and OpenCode need a Playwright or Chrome DevTools MCP server first. It is slower than the API and needs you signed in, so it suits a report you run by hand or from a scheduler on your own computer.
Skills are free to use with any agent. Briefkin is where their results land: one board for every report, number and question your agents send, with a ping when something needs you.
Free during the open beta. No card.