From adc78315a150736b5505645bf59420fd775ae5f8 Mon Sep 17 00:00:00 2001 From: Witek Bedyk Date: Thu, 14 Apr 2022 15:20:07 +0200 Subject: [PATCH] Recreate the database on each run The purpose is to drop the last measurement on uncompleted aggregation period. --- metrics/access/aggregate.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/metrics/access/aggregate.php b/metrics/access/aggregate.php index 05477a48..205b47f7 100755 --- a/metrics/access/aggregate.php +++ b/metrics/access/aggregate.php @@ -443,6 +443,8 @@ function write($points) if (!$database) { $database = InfluxDB\Client::fromDSN('influxdb://0.0.0.0:8086/osrt_access'); + $database->drop(); + $database->create(); } if (!$database->writePoints($points, Database::PRECISION_SECONDS)) die('failed to write points');