From 735573e61bd73eec9b5e9fc1e9a2916e8d7ef00e Mon Sep 17 00:00:00 2001
From: Jon Chambers <jon@signal.org>
Date: Thu, 3 Jun 2021 16:09:10 -0400
Subject: [PATCH] Make reporting intervals configurable.

---
 .../textsecuregcm/WhisperServerService.java            |  5 +++++
 .../configuration/DatadogConfiguration.java            | 10 ++++++++++
 2 files changed, 15 insertions(+)

diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerService.java b/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerService.java
index 85f8c4a02..385717608 100644
--- a/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerService.java
+++ b/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerService.java
@@ -293,6 +293,11 @@ public class WhisperServerService extends Application<WhisperServerConfiguration
         public String apiKey() {
           return config.getDatadogConfiguration().getApiKey();
         }
+
+        @Override
+        public Duration step() {
+          return config.getDatadogConfiguration().getStep();
+        }
       }, Clock.SYSTEM);
 
       datadogMeterRegistry.config().meterFilter(new MeterFilter() {
diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/configuration/DatadogConfiguration.java b/service/src/main/java/org/whispersystems/textsecuregcm/configuration/DatadogConfiguration.java
index e195682d0..6731a2bb1 100644
--- a/service/src/main/java/org/whispersystems/textsecuregcm/configuration/DatadogConfiguration.java
+++ b/service/src/main/java/org/whispersystems/textsecuregcm/configuration/DatadogConfiguration.java
@@ -7,6 +7,8 @@ package org.whispersystems.textsecuregcm.configuration;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
 import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import java.time.Duration;
 
 public class DatadogConfiguration {
 
@@ -14,7 +16,15 @@ public class DatadogConfiguration {
   @NotBlank
   private String apiKey;
 
+  @JsonProperty
+  @NotNull
+  private Duration step = Duration.ofSeconds(10);
+
   public String getApiKey() {
     return apiKey;
   }
+
+  public Duration getStep() {
+    return step;
+  }
 }
-- 
GitLab