aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-telemetry-core
diff options
context:
space:
mode:
authorAlain Kermis <alain.kermis@sonarsource.com>2024-07-18 10:46:37 +0200
committersonartech <sonartech@sonarsource.com>2024-07-24 20:02:48 +0000
commit0ce62a09539920b477873c2c26e9a6d2fc62a15e (patch)
tree0b1d8bad035a2b2c19ae839df91a7fa383899426 /server/sonar-telemetry-core
parentb128adde3ba0a0b20189f90fde15d94490c7de52 (diff)
downloadsonarqube-0ce62a09539920b477873c2c26e9a6d2fc62a15e.tar.gz
sonarqube-0ce62a09539920b477873c2c26e9a6d2fc62a15e.zip
SONAR-22479 Introduce ADHOC granularity
Diffstat (limited to 'server/sonar-telemetry-core')
-rw-r--r--server/sonar-telemetry-core/src/main/java/org/sonar/telemetry/core/Granularity.java1
-rw-r--r--server/sonar-telemetry-core/src/main/java/org/sonar/telemetry/core/TelemetryDataProvider.java3
-rw-r--r--server/sonar-telemetry-core/src/test/java/org/sonar/telemetry/core/GranularityTest.java1
3 files changed, 4 insertions, 1 deletions
diff --git a/server/sonar-telemetry-core/src/main/java/org/sonar/telemetry/core/Granularity.java b/server/sonar-telemetry-core/src/main/java/org/sonar/telemetry/core/Granularity.java
index be5cd22bb93..e66b2a83f87 100644
--- a/server/sonar-telemetry-core/src/main/java/org/sonar/telemetry/core/Granularity.java
+++ b/server/sonar-telemetry-core/src/main/java/org/sonar/telemetry/core/Granularity.java
@@ -27,6 +27,7 @@ import com.fasterxml.jackson.annotation.JsonValue;
* Modifying this enum needs to be discussed beforehand with Data Platform team.
*/
public enum Granularity {
+ ADHOC("adhoc"),
DAILY("daily"),
WEEKLY("weekly"),
MONTHLY("monthly");
diff --git a/server/sonar-telemetry-core/src/main/java/org/sonar/telemetry/core/TelemetryDataProvider.java b/server/sonar-telemetry-core/src/main/java/org/sonar/telemetry/core/TelemetryDataProvider.java
index a464014e767..b29fec4057b 100644
--- a/server/sonar-telemetry-core/src/main/java/org/sonar/telemetry/core/TelemetryDataProvider.java
+++ b/server/sonar-telemetry-core/src/main/java/org/sonar/telemetry/core/TelemetryDataProvider.java
@@ -20,6 +20,7 @@
package org.sonar.telemetry.core;
import java.util.Map;
+import java.util.Optional;
/**
* This interface is used to provide data to the telemetry system. The telemetry system will call the methods of this interface to get the
@@ -61,7 +62,7 @@ public interface TelemetryDataProvider<T> {
*
* @return the value of the data provided by this instance.
*/
- default T getValue() {
+ default Optional<T> getValue() {
throw new IllegalStateException("Not implemented");
}
diff --git a/server/sonar-telemetry-core/src/test/java/org/sonar/telemetry/core/GranularityTest.java b/server/sonar-telemetry-core/src/test/java/org/sonar/telemetry/core/GranularityTest.java
index a4b01e93305..44ef21c9298 100644
--- a/server/sonar-telemetry-core/src/test/java/org/sonar/telemetry/core/GranularityTest.java
+++ b/server/sonar-telemetry-core/src/test/java/org/sonar/telemetry/core/GranularityTest.java
@@ -30,6 +30,7 @@ class GranularityTest {
assertEquals("daily", Granularity.DAILY.getValue());
assertEquals("weekly", Granularity.WEEKLY.getValue());
assertEquals("monthly", Granularity.MONTHLY.getValue());
+ assertEquals("adhoc", Granularity.ADHOC.getValue());
}
}