collect device metrics

This commit is contained in:
liamcottle
2024-03-14 00:55:27 +13:00
parent 7f1bc47b87
commit b812d730dc
3 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,16 @@
-- CreateTable
CREATE TABLE `device_metrics` (
`id` BIGINT NOT NULL AUTO_INCREMENT,
`node_id` BIGINT NOT NULL,
`battery_level` INTEGER NULL,
`voltage` DECIMAL(65, 30) NULL,
`channel_utilization` DECIMAL(65, 30) NULL,
`air_util_tx` DECIMAL(65, 30) NULL,
`created_at` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
`updated_at` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
INDEX `device_metrics_created_at_idx`(`created_at`),
INDEX `device_metrics_updated_at_idx`(`updated_at`),
INDEX `device_metrics_node_id_idx`(`node_id`),
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

View File

@ -82,6 +82,24 @@ model NeighbourInfo {
@@map("neighbour_infos")
}
model DeviceMetric {
id BigInt @id @default(autoincrement())
node_id BigInt
battery_level Int?
voltage Decimal?
channel_utilization Decimal?
air_util_tx Decimal?
created_at DateTime @default(now())
updated_at DateTime @default(now()) @updatedAt
@@index(created_at)
@@index(updated_at)
@@index(node_id)
@@map("device_metrics")
}
model TraceRoute {
id BigInt @id @default(autoincrement())
node_id BigInt