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
@@ -3,7 +3,7 @@
|
||||
use std::process::{Command as Process, Stdio};
|
||||
use std::sync::Arc;
|
||||
|
||||
use sccache_dash::app::{unix_now, App, Config};
|
||||
use sccache_dash::app::{App, Config};
|
||||
use sccache_dash::{http, systemd};
|
||||
|
||||
const USAGE: &str = "\
|
||||
@@ -79,7 +79,7 @@ fn parse(args: &[String]) -> Result<Command, String> {
|
||||
}
|
||||
|
||||
fn serve(port: u16, open: bool) -> Result<(), String> {
|
||||
let app = Arc::new(App::new(Config::from_env()?, unix_now())?);
|
||||
let app = Arc::new(App::new(Config::from_env()?));
|
||||
let server = http::listen(port)?;
|
||||
let port = http::port_of(&server);
|
||||
let url = format!("http://127.0.0.1:{port}");
|
||||
|
||||
Reference in new issue
Block a user