Skip to main content

statsbadge-cloudflare

Your Cloudflare traffic as readings, for statsbadge.

Every domain on your account becomes a source you can point a page at: requests a minute, bytes a second, cache hit rate, and the day's totals. There is a Cloudflare, all domains source too, for a page that wants one number for everything.

Install

statsbadge ext add cloudflare

Then, in the config UI under Extensions, paste an API token. The domains appear as checkboxes on the next reload, and each one that is ticked becomes a source in the field pickers.

Up to eight domains are ticked by default, keeping the payload small.

The token

Make one at dash.cloudflare.com/profile/api-tokens with two permissions:

Permission What it is for
Zone / Zone / Read listing the domains. It is the only place their names exist
Zone / Analytics / Read the traffic

Include every zone you want to see. The token is stored in the host's config file in plain text.

Settings

Setting What it does
API token The token above
One per domain Whether to watch it. Untick what you are not going to draw

What each domain reports

Reading What it is
Requests / min Averaged over the last five minutes
Served Bytes a second over the same five minutes
Cached % Of today's requests, how many the edge answered
Requests today Today so far, in UTC
Page views today
Unique visitors today
Threats today What Cloudflare blocked or challenged
Served today

The totals source has all of these bar unique visitors, plus how many domains are being watched. A visitor to two of your sites is two uniques, so summing them counts nobody in particular.

Requests, bytes and the cache hit rate are graphable, and the history is Cloudflare's: a day of hourly points, so a graph shows the shape of a day rather than the last ninety seconds. It is there the moment you add the page, and requests and bytes are scaled vertically to fill up the graph.

Notes

The names come from the REST API and the numbers from GraphQL, both under api.cloudflare.com/client/v4 and both on the same token. Zone Analytics' own REST endpoint refuses an account-owned token outright and names GraphQL as its replacement, so that is the one used.

Live figures come from httpRequestsAdaptiveGroups, which reports by the minute and is current to about a minute. Its count is already corrected for sampling: measured against the hourly dataset over the same hour, the two agree to within a percent. The window ends a minute back, because the newest minute is still being written.

The daily figures are today so far in UTC, not a rolling twenty-four hours, which is what Cloudflare's own dashboard shows for the day.

The graph's points are hourly buckets, oldest to newest, with the hour in progress left off: a bucket a few minutes into its hour reads as traffic falling off a cliff, which is the shape of a partial count and not of a day. An hour with no traffic at all is a bucket Cloudflare leaves out, and it is drawn as a gap rather than closed up.

Requests are per minute and bytes per second whether they are being read now or plotted from an hour ago, so the reading beside a sparkline is in the units the line is drawn in.

These readings change once a minute and the badge polls once a second, so they are declared slow: the host sends them when they change and the badge holds on to them in between. Watching six domains costs about 1.7KB a second on the wire without that, and nothing with it.

One request covers every domain at once, however many are ticked, so the GraphQL API's limit of 300 queries in five minutes is nowhere in sight at a request a minute.

The domain list is kept between runs, so the checkboxes are there before the first fetch lands and a save made while the network is down does not lose which ones you had ticked.

Metadata

Release files for statsbadge-cloudflare 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for statsbadge-cloudflare 2.0.0
File Size Uploaded Provenance Actions
statsbadge_cloudflare-2.0.0.tar.gz 11.1 kB Without provenance Details for statsbadge_cloudflare-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for statsbadge-cloudflare 2.0.0
File Interpreter ABI Platform Actions
statsbadge_cloudflare-2.0.0-py3-none-any.whl Python 3 none any Details for statsbadge_cloudflare-2.0.0-py3-none-any.whl

Total release size: 22.9 kB

Release files / statsbadge_cloudflare-2.0.0.tar.gz

Download URL statsbadge_cloudflare-2.0.0.tar.gz
Size 11.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d563ab6819e517f6a20d18d619531cee26acb01b46e2789d9fb318b2f6ad5177
BLAKE2b-256 checksum
How to use checksums
1235fd733cb10703504ee8736bbf09714992d7b5578f5f99a2b045424296f420
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.18 {"installer":{"name":"uv","version":"0.12.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / statsbadge_cloudflare-2.0.0-py3-none-any.whl

Download URL statsbadge_cloudflare-2.0.0-py3-none-any.whl
Size 11.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b8749b940b52489ba9aaf5f62cfdbb0b5e8b4373e0c0d0799715dc7f57376caa
BLAKE2b-256 checksum
How to use checksums
679e2f8939b50a358004b027eb738ae9090044179b7f959494a23ce5d2084d09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.18 {"installer":{"name":"uv","version":"0.12.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for statsbadge-cloudflare 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page