Keep the history in SQLite, one view per range made after each poll
Each row of the readings table is the difference since the row before it, at most one a minute and only when something changed, so a range total is one indexed query. Per-language counts, not-cacheable reasons and build observations have their own tables; what the last poll and the last row saw is remembered in the state table, so differences survive a restart. The five views are computed once per poll and kept; /api/view answers from them and never touches the database, which only the polling task holds. /api/zero wakes that task instead of reading the counters itself. Build observations: after a poll in which every build that finished was of one language, one row with the difference in compilations and compile time, for the build-time histogram. Time saved uses their per-language average. Views fill the api's build_times and interval_90 as empty/None.
This commit is contained in:
1 parent
a83ae5e0d9
commit
7f58931b7b
8 files changed
+970
-642
No files matched your search
@@ -39,11 +39,15 @@ that origin is this server, so a web page elsewhere cannot zero the stats.
|
||||
|
||||
## Where history lives
|
||||
|
||||
`$XDG_DATA_HOME/sccache-dash/history.jsonl` (`~/.local/share/...` by default): one compact JSON
|
||||
line per reading, oldest first, at most one a minute and only when sccache's counters changed,
|
||||
plus one every ten minutes so that time with the service running can be told from time it was
|
||||
not. A reading is a few hundred bytes. Lines older than 30 days are deleted at startup and once
|
||||
a day. Deleting the file loses the history and nothing else.
|
||||
`$XDG_DATA_HOME/sccache-dash/history.db` (`~/.local/share/...` by default): one SQLite file. Its
|
||||
`readings` table holds one row a minute at most, and only when sccache's counters changed; each
|
||||
row is the difference since the row before it, so a range total is one indexed query. Per-language
|
||||
counts and not-cacheable reasons sit in their own tables, and `build_obs` holds what the polls saw
|
||||
of how long a build of each language takes. A stretch without rows is a gap. Rows older than 30
|
||||
days are deleted at startup and once a day. Deleting the file loses the history and nothing else.
|
||||
|
||||
The five views (one per range) are made after every poll and kept in memory, so a request never
|
||||
waits for the database.
|
||||
|
||||
A counter that goes down means sccache reset its counters (`--zero-stats`, or its server
|
||||
restarted): the range counts start again from zero there and the chart marks the spot. The first
|
||||
|
||||
Reference in new issue
Block a user