From b637222980b453cdb9dc374e1201b5d9bda8e0a5 Mon Sep 17 00:00:00 2001 From: Levi Schoen Date: Tue, 31 Oct 2023 12:35:50 -0700 Subject: [PATCH] account for partition gap when metric collection is flipped periodically (#51) --- architecture/METRIC_COMPACTION_ROUTINE.md | 2 +- routines/metric_partitioning.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/architecture/METRIC_COMPACTION_ROUTINE.md b/architecture/METRIC_COMPACTION_ROUTINE.md index dd8678f..eb5d21c 100644 --- a/architecture/METRIC_COMPACTION_ROUTINE.md +++ b/architecture/METRIC_COMPACTION_ROUTINE.md @@ -11,7 +11,7 @@ The Metric Pruning routine is responsible for deleting any metrics that are olde ```bash # Whether metric pruning routines should run on the configured interval, defaults to true METRIC_PRUNING_ENABLED=true -# How frequenlty metric pruning routines should run +# How frequently metric pruning routines should run # defaults to 1 day METRIC_PRUNING_ROUTINE_INTERVAL_SECONDS=10 # how long (after the proxy service starts) it will wait diff --git a/routines/metric_partitioning.go b/routines/metric_partitioning.go index 57c96fa..9d96026 100644 --- a/routines/metric_partitioning.go +++ b/routines/metric_partitioning.go @@ -115,7 +115,8 @@ func partitionsForPeriod(start time.Time, numDaysToPrefill int) ([]PartitionPeri daysInCurrentMonth := daysInMonth(start) - newDaysRemainingInCurrentMonth := daysInCurrentMonth - currentDay + // add one to include the current day + newDaysRemainingInCurrentMonth := daysInCurrentMonth - currentDay + 1 // generate partitions for current month totalPartitionsToGenerate := numDaysToPrefill