diff options
author | Alain Kermis <alain.kermis@sonarsource.com> | 2024-07-19 16:01:17 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-07-24 20:02:49 +0000 |
commit | af66f272ea91ce1a132dc40260247ec720741270 (patch) | |
tree | 284809c7f15e26434947a207c55eb43d47c3a0cc /server/sonar-telemetry/src | |
parent | 9258d5846d5e0947a7ff7813751224af537b20ee (diff) | |
download | sonarqube-af66f272ea91ce1a132dc40260247ec720741270.tar.gz sonarqube-af66f272ea91ce1a132dc40260247ec720741270.zip |
SONAR-22479 Implement after() method for providers
Diffstat (limited to 'server/sonar-telemetry/src')
-rw-r--r-- | server/sonar-telemetry/src/main/java/org/sonar/telemetry/TelemetryDaemon.java | 3 | ||||
-rw-r--r-- | server/sonar-telemetry/src/main/java/org/sonar/telemetry/metrics/TelemetryMetricsLoader.java | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/server/sonar-telemetry/src/main/java/org/sonar/telemetry/TelemetryDaemon.java b/server/sonar-telemetry/src/main/java/org/sonar/telemetry/TelemetryDaemon.java index a528094695a..f920ff8956a 100644 --- a/server/sonar-telemetry/src/main/java/org/sonar/telemetry/TelemetryDaemon.java +++ b/server/sonar-telemetry/src/main/java/org/sonar/telemetry/TelemetryDaemon.java @@ -169,6 +169,9 @@ public class TelemetryDaemon extends AbstractStoppableScheduledExecutorServiceIm context.getMetricsToUpdate().forEach(toUpdate -> dbClient.telemetryMetricsSentDao().upsert(dbSession, toUpdate)); dbSession.commit(); } + + // Finally, run after tasks for all providers + telemetryMetricsLoader.runProviderAfterTasks(); } private void uploadLegacyTelemetry() throws IOException { diff --git a/server/sonar-telemetry/src/main/java/org/sonar/telemetry/metrics/TelemetryMetricsLoader.java b/server/sonar-telemetry/src/main/java/org/sonar/telemetry/metrics/TelemetryMetricsLoader.java index f232fe82fce..aeb5f3c3074 100644 --- a/server/sonar-telemetry/src/main/java/org/sonar/telemetry/metrics/TelemetryMetricsLoader.java +++ b/server/sonar-telemetry/src/main/java/org/sonar/telemetry/metrics/TelemetryMetricsLoader.java @@ -90,6 +90,10 @@ public class TelemetryMetricsLoader { } } + public void runProviderAfterTasks() { + this.providers.forEach(TelemetryDataProvider::after); + } + private Set<BaseMessage> retrieveBaseMessages(Map<Dimension, Set<Metric>> metrics) { return metrics.entrySet().stream() // we do not want to send payloads with zero metrics |