From bd1bd007c006b3b206b74aa72a0114920514accd Mon Sep 17 00:00:00 2001 From: Katherine Yen Date: Tue, 5 Aug 2025 11:37:06 -0400 Subject: [PATCH] Count successful timezone parsing to get a ratio of success to failures --- .../textsecuregcm/scheduler/SchedulingUtil.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/scheduler/SchedulingUtil.java b/service/src/main/java/org/whispersystems/textsecuregcm/scheduler/SchedulingUtil.java index d45df08ef..00ad32575 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/scheduler/SchedulingUtil.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/scheduler/SchedulingUtil.java @@ -23,7 +23,8 @@ import org.whispersystems.textsecuregcm.metrics.MetricsUtil; import org.whispersystems.textsecuregcm.storage.Account; public class SchedulingUtil { - private static final String NO_TIMEZONE_COUNTER_NAME = MetricsUtil.name(SchedulingUtil.class, "noTimezone"); + private static final String PARSED_TIMEZONE_COUNTER_NAME = MetricsUtil.name(SchedulingUtil.class, "parsedTimezone"); + private static final String HAS_TIMEZONE_TAG_NAME = "hasTimezone"; /** * Gets a present or future time at which to send a notification to a device associated with the given account. This @@ -44,9 +45,12 @@ public class SchedulingUtil { final Clock clock) { final ZonedDateTime candidateNotificationTime = getZoneId(account, clock) - .map(zoneId -> ZonedDateTime.now(clock.withZone(zoneId)).with(preferredTime)) + .map(zoneId -> { + Metrics.counter(PARSED_TIMEZONE_COUNTER_NAME, HAS_TIMEZONE_TAG_NAME, String.valueOf(true)).increment(); + return ZonedDateTime.now(clock.withZone(zoneId)).with(preferredTime); + }) .orElseGet(() -> { - Metrics.counter(NO_TIMEZONE_COUNTER_NAME).increment(); + Metrics.counter(PARSED_TIMEZONE_COUNTER_NAME, HAS_TIMEZONE_TAG_NAME, String.valueOf(false)).increment(); return ZonedDateTime.now(ZoneId.systemDefault()).with(preferredTime); });