Skip to content

Commit b95ebb7

Browse files
committed
Create new table for collector_config, configuration for the collectors
1 parent 8a9b364 commit b95ebb7

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

database/schema.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,3 +258,15 @@ aid benchmark error
258258
---------- --- -----
259259
1 syn-1.0.89 Failed to compile...
260260
```
261+
262+
### collector_config
263+
264+
Information about the collector; it's target architecture, when it was added, whether it is active and when it last had activity denoted by `last_heartbeat_at`.
265+
266+
```
267+
sqlite> SELECT * FROM collector_config;
268+
269+
id target date_added last_heartbeat_at benchmark_set is_active
270+
--------- ------------------------- ------------- ---------------- --------- -------
271+
ea1f4e... aarch64-unknown-linux-gnu 2025-06-11... 2025-06-12 17... cea1bc... 0
272+
```

database/src/pool/postgres.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,17 @@ static MIGRATIONS: &[&str] = &[
285285
alter table pstat_series drop constraint test_case;
286286
alter table pstat_series add constraint test_case UNIQUE(crate, profile, scenario, backend, target, metric);
287287
"#,
288+
r#"CREATE EXTENSION IF NOT EXISTS "uuid-ossp";"#,
289+
r#"
290+
CREATE TABLE IF NOT EXISTS collector_config (
291+
id UUID PRIMARY KEY,
292+
target TEXT NOT NULL,
293+
date_added TIMESTAMPTZ DEFAULT NOW() NOT NULL,
294+
last_heartbeat_at TIMESTAMPTZ,
295+
benchmark_set UUID NOT NULL,
296+
is_active BOOLEAN DEFAULT FALSE NOT NULL
297+
);
298+
"#,
288299
];
289300

290301
#[async_trait::async_trait]

database/src/pool/sqlite.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,18 @@ static MIGRATIONS: &[Migration] = &[
404404
alter table pstat_series_with_target rename to pstat_series;
405405
"#,
406406
),
407+
Migration::without_foreign_key_constraints(
408+
r#"
409+
CREATE TABLE IF NOT EXISTS collector_config (
410+
id TEXT PRIMARY KEY,
411+
target TEXT NOT NULL,
412+
date_added TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
413+
last_heartbeat_at TIMESTAMP,
414+
benchmark_set TEXT NOT NULL,
415+
is_active BOOLEAN DEFAULT FALSE NOT NULL
416+
);
417+
"#,
418+
),
407419
];
408420

409421
#[async_trait::async_trait]

0 commit comments

Comments
 (0)