Skip to content

Feat; Create new table for collector configuration #2157

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions database/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,3 +258,15 @@ aid benchmark error
---------- --- -----
1 syn-1.0.89 Failed to compile...
```

### collector_config

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`.

```
sqlite> SELECT * FROM collector_config;

id target name date_added last_heartbeat_at benchmark_set is_active
--------- ------------------------- ---- ------------- ---------------- --------- -------
1 aarch64-unknown-linux-gnu foo 2025-06-11... 2025-06-12 17... 2 0
```
16 changes: 16 additions & 0 deletions database/src/pool/postgres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,22 @@ static MIGRATIONS: &[&str] = &[
);
CREATE INDEX IF NOT EXISTS benchmark_request_status_idx on benchmark_request (status) WHERE status != 'completed';
"#,
r#"
CREATE TABLE IF NOT EXISTS collector_config (
id SERIAL PRIMARY KEY,
target TEXT NOT NULL,
name TEXT NOT NULL UNIQUE,
date_added TIMESTAMPTZ DEFAULT NOW() NOT NULL,
last_heartbeat_at TIMESTAMPTZ,
benchmark_set INTEGER NOT NULL,
is_active BOOLEAN DEFAULT FALSE NOT NULL,

-- Given the current setup, we do not want 2 collectors that are active
-- with the same target using the same benchmark set.
CONSTRAINT collector_config_target_bench_active_uniq
UNIQUE (target, benchmark_set, is_active)
);
"#,
];

#[async_trait::async_trait]
Expand Down
Loading