Cloudflare analytics with Workers

Cloudflare Workers allows you to run JavaScript from Cloudflare’s 150+ data centers. Learn more about Workers here!


What is a subrequest?

With a no-op Worker (a Worker that simply proxies traffic by passing on the original client request to the origin and proxying the response) running on a particular route, the request to the origin is counted as a “subrequest”, separate from initial client to edge request. Thus, unless the Worker responds with a static response and never hits an origin, the eyeball → edge request, and edge → origin request will each be counted separately towards the request or bandwidth count in Analytics.  Subrequests are not included in the Requests or Bandwidth graphs of the Cloudflare Analytics app.


Zone analytics

In the dashboard, the numbers in zone analytics reflect visitor traffic. That is, the number of requests shown in zone analytics (under the Analytics tabs in the dashboard) is the number of requests that were served to the client.

Similarly, the bandwidth is counted based on the bandwidth that is sent to the client, and status codes reflect the status codes that were served back to the client (so if a subrequest received a 500, but you respond with a 200, a 200 will be shown in the status codes breakdown).


Worker analytics

For a breakdown of subrequest traffic (origin facing traffic), you may go to the Cloudflare Analytics app and click on the Workers tab. Under the Workers tab, below the Service Workers panel, you will see a Subrequests breakdown by count, Bandwidth and Status Codes. This will help you spot and debug errors at your origin (such as spikes in 500s), and identify your cache-hit ratio to help you understand traffic going to your origin.


FAQ:

Why don’t I see any analytics for Workers?

  • If you are not currently using Workers (don’t have Workers deployed on any routes or filters), we will not have any information to show you.
  • If your Worker sends a static response back to the client without ever calling fetch() to an origin, you are not making any subrequests, thus, all traffic will be shown in zone Analytics

Why can’t I see any subrequests prior to 2018-08-16 22:00 UTC?

While you can’t get subrequest information prior to this date, you will still be able to get this information about the client-facing traffic in the Analytics tab. If you are on our Enterprise plan, you may still get data for previous dates from our Cloudflare Logs.

Will this impact billing? 

No, billing for Workers is based on requests that go through a Worker. 

Why am I seeing such a high cache hit ratio?

Requests served by a Worker always show as cached. For an accurate cache hit ratio on subrequests, see the Subrequests graph in the Analytics app under the Workers analytics tab.

Not finding what you need?

95% of questions can be answered using the search tool. This is the quickest way to get a response.

Powered by Zendesk