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 3 commits into
base: master
Choose a base branch
from

Conversation

Jamesbarford
Copy link
Contributor

  • Adds UUID extension for postgres
  • Creates a table for collector configuration; storing the target, whether the collector is active and able to take work. Has a heartbeat column so we can see if the collector goes offline. benchmark_set is for when we start splitting work between collectors

r#"CREATE EXTENSION IF NOT EXISTS "uuid-ossp";"#,
r#"
CREATE TABLE IF NOT EXISTS collector_config (
id UUID PRIMARY KEY,
Copy link
Contributor

@Kobzol Kobzol Jun 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will have probably max. 4? collectors in the near future 😅 So I think that UUIDs are overkill. My experience with messing with Postgres extensions is that it can go wrong, I would prefer to avoid this and just use good ol' autoincremented IDs.

On the other hand, I'd like to assign human-readable names to the collectors, for easier debugging. So please add a name TEXT NOT NULL column, thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@Kobzol Kobzol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I think that the table looks good like it is, but also I don't think we necessarily need to merge this outright.

So I'd keep this lying here until we have some actual code (probably first in the website) that actually needs to use this table, and then write the corresponding DbPool queries so that we have a user of the table. Maybe we'll figure out that we need some additional columns by then or something.

```
sqlite> SELECT * FROM collector_config;

id target date_added last_heartbeat_at benchmark_set is_active
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please update this with name? Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -404,6 +404,19 @@ static MIGRATIONS: &[Migration] = &[
alter table pstat_series_with_target rename to pstat_series;
"#,
),
Migration::without_foreign_key_constraints(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should "delay" the tables on the SQLite side until we finish the Postgres implementation? Just to potentially avoid needless migrations (i.e. Postgres could serve as a "testbed" for the DB). I'm not even sure if we'll ever need this table on the SQLite side, tbh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants