A Telemetry Backend Built Into Workers

Cloudflare has launched Workers Analytics Engine, a time-series analytics service that runs directly on the Workers platform. The goal is to give developers a way to collect structured events from their code without standing up a separate metrics stack. The service is powered by the same infrastructure that handles Cloudflare’s own analytics, which processes tens of millions of events per second.

Workers Analytics Engine is not limited to monitoring your own Workers. The initial use case was internal: Cloudflare’s R2 storage team uses it to track read and write counts, transfer bytes, and operation durations. But the model generalizes to any event stream. A developer could build a fail2ban-style security layer by logging login attempts with IP and location data, then querying that history to block repeat offenders. The same mechanism could ingest weather or air-quality reports from IoT sensors, with a Worker deployed in minutes to handle collection.

Data Model and API

Getting started requires three steps: create a binding in wrangler.toml, call writeDataPoint() from the Workers runtime, then query results via SQL or the GraphQL API.

The binding gives you an environment variable in your Worker with a writeDataPoint() method. A data point has two parts: blobs for string fields used in grouping and filtering, and doubles for numeric fields that can be summed, averaged, or quantiled. An air-quality reading, for example, would store temperature and pressure as doubles and the sensor’s location and ID as blobs.

In the current beta there is no schema—you keep blob and double order consistent across your writes. Named fields are on the roadmap. The current SQL API uses 1-based indexing for blobs and doubles. Queries look like this:

SELECT blob_1 as city, avg(doubles_2) as avg_humidity
FROM WEATHER
WHERE double_1 > 0
ORDER BY avg_humidity DESC
LIMIT 10

That query returns the top ten cities by average humidity for readings above freezing.

Every data point automatically receives a timestamp, which simplifies dashboarding. The service is built for Grafana-style visualizations:

BLOG-1062 Embedded Image - Erte4R

The $timeSeries macro expands to the timestamp rounded to the nearest minute and converted to milliseconds. The Cloudflare dashboard currently shows total counts per binding; richer analytic views are in development.

Why Event Logs Beat Metrics

Cloudflare designed this system as an alternative to traditional pull-based metrics tools like Prometheus. The key architectural difference: writing structured events to a queryable datastore is more flexible than maintaining a fixed set of metric series. There are three main advantages over a Prometheus-style setup.

  • Unlimited cardinality: In a metrics system, each new label value effectively creates a new metric. Add a customer_id label and you multiply your metric count by your user base. With Analytics Engine, each structured blob value is stored independently, so high-cardinality labels are not a constraint.
  • Low reporting latency: Pull-based systems only see data on their scrape interval, commonly a minute or more. Analytics Engine can surface a new data point within seconds of it being written.
  • Query speed across time ranges: Retrieving a week of data from a pull-based metrics store typically requires extra infrastructure. Analytics Engine queries data from the past five minutes to the past seven days with the same fast response.

Since it runs on Cloudflare’s global network, there is no server to operate, no cluster to scale, and no separate storage tier to maintain. You write data points from your Worker and query them with SQL. The GraphQL API is available as well, though it currently only returns total event counts per binding.

Roadmap

The beta permits one binding per account; multiple bindings and runtime-defined events are planned. Public documentation and a getting-started guide will appear on the Cloudflare developer site, and Cloudflare is soliciting early feedback on the service. One larger goal is to support usage-based billing and embedded analytics for platforms that resell Cloudflare’s infrastructure—essentially, letting you give your own customers the same kind of telemetry console.