Skip to content

Alerts

What to be told about, and how to set it up in Cloudflare under Observability > Alerts. Metrics are in metrics, and traces and request ids in observability.

Monitors are in beta. Each one runs a query against a Cloudflare SQL API dataset on a schedule, and notifies when the result crosses a threshold. They are created in the dashboard. The queries below are for the dataset fiber_metrics: if you changed it (metrics), use your name.

Attempts are written as metrics describes: blob1 is wait or run, blob2 how the attempt ended, and double1 its seconds.

Once a minute, the engine’s cron also writes one reading of the queue:

Column Holds
blob1 queue
double1 Steps waiting for an agent
double2 Steps held by an agent
double3 Seconds the oldest step that could be given out has waited; 0 when none waits

A step held back by retry backoff waits on purpose, and is not counted as the oldest. A reading is written when nothing waits too, so that no reading means something is wrong.

Analytics Engine samples what it keeps, even at low volume. A COUNT is weighted for that. A MAX is not weighted, but a reading left out only delays an alert by a minute.

Under Observability > Alerts > Destinations, add where alerts go. Email and webhooks are on every plan; PagerDuty needs Business or higher.

Create each one under Observability > Alerts > Monitors: Create a Monitor, Threshold, then custom SQL. Replace <ACCOUNT_TAG> with your account id. Leave the time range on Automatic, so that each run reads the time since the last one: the execution interval below is also the window.

The one to have first. It climbs when no agent has a step’s labels, or every agent is busy or gone, which is otherwise seen only when someone wonders why a run sits still.

SELECT MAX(double3) AS value
FROM events.analyticsEngine.fiber_metrics
WHERE accountTag = '<ACCOUNT_TAG>' AND blob1 = 'queue'

Greater than 900, every 5m. Choose the number of seconds from how long your steps usually wait: fiber_step_queue_wait_seconds on /metrics shows it.

The engine’s cron, or its dispatcher, has stopped. Then nothing is given out, and the monitor above has nothing to see.

SELECT COUNT(*) AS value
FROM events.analyticsEngine.fiber_metrics
WHERE accountTag = '<ACCOUNT_TAG>' AND blob1 = 'queue'

Less than 1, every 10m. A dispatcher that throws when asked fails the cron as well, which shows in the engine’s logs.

An attempt is reclaimed when its agent stopped answering while it held the step: the machine went away, lost its network, or was stopped mid-step. A few are normal when agents are replaced; many mean agents are failing.

SELECT COUNT(*) AS value
FROM events.analyticsEngine.fiber_metrics
WHERE accountTag = '<ACCOUNT_TAG>' AND blob1 = 'run' AND blob2 = 'reclaimed'

Greater than 5, every 15m. Adjust it to the number of agents you run.

The API, engine and containers Workers log what goes wrong at error level. In the API, an unexpected error is logged with its request id. In the monitor’s visual builder, choose the dataset Workers Logs, count, and filter on the Worker (fiber-api, fiber-engine or fiber-containers) and the error level. Preview it to check that the filter matches, then alert above 0, or above the count you normally see, every 5m.

The API keeps only what it logs itself: its invocation logs are off (observability).

Issues groups a Worker’s exceptions, 5xx answers and error logs, and can send each new one somewhere. It is not turned on here. An occurrence keeps “invocation and request details”, and Cloudflare does not say whether a request’s header values are among them. The API’s requests carry session and agent tokens in headers, which is why its invocation logs are off. If you turn Issues on for a Worker, do it in its wrangler.jsonc ("observability": { "issues": { "enabled": true } }), or the next deploy turns it off again.

Budget alerts, under Manage Account > Billing > Billable Usage, warn when spending passes an amount.