From f0d5c8e3d176ba9bfe0994c308807e5e6971d8b3 Mon Sep 17 00:00:00 2001 From: Mateusz Kwasniewski Date: Fri, 16 Feb 2024 08:36:25 +0100 Subject: [PATCH] fix: include first day of range in the extended metrics (#6245) --- .../features/metrics/client-metrics/metrics-service-v2.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/features/metrics/client-metrics/metrics-service-v2.ts b/src/lib/features/metrics/client-metrics/metrics-service-v2.ts index 50796e4c2a..47b40c83cb 100644 --- a/src/lib/features/metrics/client-metrics/metrics-service-v2.ts +++ b/src/lib/features/metrics/client-metrics/metrics-service-v2.ts @@ -223,10 +223,13 @@ export default class ClientMetricsServiceV2 { let hours: HourBucket[]; let metrics: IClientMetricsEnv[]; if (this.flagResolver.isEnabled('extendedUsageMetrics')) { + // if we're in the daily range we need to add one more day + const normalizedHoursBack = + hoursBack > 48 ? hoursBack + 24 : hoursBack; metrics = await this.clientMetricsStoreV2.getMetricsForFeatureToggleV2( featureName, - hoursBack, + normalizedHoursBack, ); hours = hoursBack > 48