Skip to content

feat/dev: Add Cloudflare traffic reports - #1890

Open
marcleblanc2 wants to merge 12 commits into
mainfrom
page-views-report
Open

feat/dev: Add Cloudflare traffic reports#1890
marcleblanc2 wants to merge 12 commits into
mainfrom
page-views-report

Conversation

@marcleblanc2

@marcleblanc2 marcleblanc2 commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Adds viewership-metrics/page-views-report.mjs, a dependency-free Node script that pulls 90 days of Cloudflare analytics for /docs, /changelog and /blog on sourcegraph.com and writes Markdown reports to viewership-metrics/reports/ (gitignored). See viewership-metrics/README.md.

What it reports

  • Page views (HTML 200s), visits, 3xx, 404 and 5xx per path, in four files sorted by path, requests, redirects and errors
  • redirect-rules.md: hits per rule in src/data/redirects.ts, flagging rules shadowed by an earlier duplicate source and redirect chains (a destination that is itself another rule's source)

Filters

Bot Management likely_human, excluding ASN Hetzner Online GmbH and country CN. Skips /_next, static assets, scanner probe paths and trailing-slash redirects.

Findings from the first 90-day run

  • 3,041 paths, 524k requests, 65k redirects, 16k 404s, 2.8k 5xx
  • 1,324 redirect rules: 962 live, 362 shadowed (never match), 689 live with zero hits
  • 269 live rules chain into another rule; longest chain is 5 extra hops. The precise_code_navigation rules alone send ~5,500 visitors through 2 or 3 redirects
  • /changelog/.api/changelog.v1.ChangelogService/ListReleasePosts returned 1,880 5xx
  • /blog/feed.atom (3,410) and /blog/feed.xml (1,000) 404 while /blog/rss.xml redirects 21,790 times
  • The docs site returns 200 for unknown paths, so deleted pages and probes like /docs/.zshrc count as views

Test

CLOUDFLARE_API_TOKEN=... npm run page-views-report -- --days 7
ls viewership-metrics/reports/

Amp threads

marcleblanc2 and others added 9 commits September 8, 2026 23:45
Counts likely-human HTML page views for /docs, /changelog and /blog over
the last 90 days via Cloudflare's GraphQL Analytics API, excluding
Hetzner and China, and writes reports to logs/ sorted by path and by
request count.

Amp-Thread-ID: https://ampcode.com/threads/T-01a08479-a4c8-72ad-8f31-fe7ecc43bf34
Co-authored-by: Amp <amp@ampcode.com>
@vercel

vercel Bot commented Sep 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
sourcegraph-docs Ready Ready Preview Sep 9, 2026 8:05am UTC

Request Review

@marcleblanc2 marcleblanc2 changed the title Add Cloudflare page views and redirect rule reports feat/dev: Add Cloudflare page views and redirect rule reports Sep 9, 2026
@marcleblanc2 marcleblanc2 changed the title feat/dev: Add Cloudflare page views and redirect rule reports feat/dev: Add Cloudflare traffic reports Sep 9, 2026
@marcleblanc2
marcleblanc2 marked this pull request as ready for review September 9, 2026 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant