Repository navigation
Websites chart automatic time grain - #1165
Merged
Merged
Conversation
The country and network pages charted every tested domain per day, whatever the range: Pakistan since 2018 asked the API for 4.1 million rows, which took down an API task (and the browser could not have drawn it). Beyond the default 30-day daily view, use week up to 13 weeks, month up to 18 months, then year, which the charts now support too. Most countries test ~2,500-2,800 domains a month, so these charts stay under about 19 buckets, around half the 100,000 rows the API will return. Each of these is a grain the API accepts for that range.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
aagbsn
marked this pull request as draft
October 8, 2026 12:28
The websites chart's "See on MAT" link can now carry time_grain=year, but MAT's form only offered hour, day, week and month, and reset anything else to day: a multi-year link turned into the multi-year daily query the websites chart now avoids. Offer year for ranges over a year, the only ranges the API accepts it for, without the slow query warning, like month. The options also came from the wrong range when the page was loaded from a link: the form's date range state kept its 30-day defaults, because the reset to the URL's values once the router is ready names no field for the watch that updates it.
Changing the dates in MAT kept the time grain, so a range over years still asked for a row per day unless the grain was changed by hand. Picking dates now picks the grain the websites chart uses for that range; it can still be changed afterwards, and links keep their own. Use year from ranges over a year, where the API starts accepting it, instead of over 18 months: charts with a row per domain then have at most 13 buckets beyond the default view.
The date picker starts a new range on each click, so picking a start day and pressing Apply gave a range without an end, and MAT cleared until. With no complete range the time grain wasn't picked either. Keep the current until instead.
aagbsn
marked this pull request as ready for review
October 8, 2026 13:13
Contributor
|
I added several improvements on this branch:
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The country and network pages charted every tested domain per day whatever the date range. Pakistan since 2018 asked the API for 4.1 million rows, which ran an API task out of memory on 2026-10-08 (the browser got a 504 after 60s, and couldn't have drawn it anyway).
Beyond the default 30-day daily view, the websites chart now uses week up to 13 weeks, month up to 18 months, then year, which the charts now support. Most countries test about 2,500–2,800 domains a month, so these views stay under about 19 buckets, no larger than the default view, with room for growth. Each grain is one the API now accepts for its range (ooni/backend#1259)
The Apps and Circumvention charts stay daily: they have only 3–4 rows per bucket.
A new Playwright test opens Canada's country page from 2023 and checks the websites chart asks for year.