-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
backend: Add instance statistics table
A by-product of the Omaha update protocol employed by Nebraska delivers statistics on version spread, but accumulating and presenting this data suffers from a number of limitations: - The chart only represents all nodes’ current OS versions. We currently do not have historic data of the nodes’ previous software versions, and we would like to track of this data. - While historic data can be calculated from update events, this is computationally intense and unfeasible in practice. We currently cannot calculate or store this historic data efficiently, and we would like to be able to have quick and easy access to this data. - To be able to back-fill the live Nebraska server using historic data available in CSV format, we need to use a third-party tool. We currently cannot accomplish this using our existing setup, and we would like to implement a mechanism to do this natively. We implement the `instance_stats` table (based on instance fields from `instance_application`) to store data on current version spread in an efficient format optimized for querying. To accomplish this, there are five data points that we associate each instance with, serving as the main fields of this table: - Timestamp: Necessary for keeping track of when update checks are performed - Channel name: Necessary to identify an individual instance - Architecture: Necessary to identify an individual instance - Version: Necessary to identify an individual instance - Instance count: Necessary for grouping instances by the previous four fields New entries to the table will be generated using a background job scheduled periodically at a specified interval.
- Loading branch information
Showing
4 changed files
with
302 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
backend/pkg/api/db/migrations/0019_add_instance_stats_table.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
-- +migrate Up | ||
|
||
create table if not exists instance_stats ( | ||
timestamp timestamptz not null, | ||
channel_name varchar(25) not null, | ||
arch varchar(7) not null, | ||
version varchar(255) not null, | ||
instances int not null check (instances >= 0), | ||
unique(timestamp, channel_name, arch, version) | ||
); | ||
|
||
-- +migrate Down | ||
|
||
drop table if exists instance_stats; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters