aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-webserver-core/src
diff options
context:
space:
mode:
authorPierre Guillot <50145663+pierre-guillot-sonarsource@users.noreply.github.com>2022-08-19 11:31:33 +0200
committersonartech <sonartech@sonarsource.com>2022-09-05 20:02:56 +0000
commit78c0eb9e35d9925b7451fea5ec4c71f82b81d258 (patch)
tree940252c3a619ba85beeda34eb98242c1ba404cf2 /server/sonar-webserver-core/src
parentc0ac92d74288cd501977d2bb661c414872236716 (diff)
downloadsonarqube-78c0eb9e35d9925b7451fea5ec4c71f82b81d258.tar.gz
sonarqube-78c0eb9e35d9925b7451fea5ec4c71f82b81d258.zip
SONAR-17194 remove temeletry from system info file
Diffstat (limited to 'server/sonar-webserver-core/src')
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/platform/AbstractSystemInfoWriter.java9
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/platform/ClusterSystemInfoWriter.java5
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/platform/StandaloneSystemInfoWriter.java5
-rw-r--r--server/sonar-webserver-core/src/test/java/org/sonar/server/platform/ClusterSystemInfoWriterTest.java11
-rw-r--r--server/sonar-webserver-core/src/test/java/org/sonar/server/platform/StandaloneSystemInfoWriterTest.java8
5 files changed, 9 insertions, 29 deletions
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/AbstractSystemInfoWriter.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/AbstractSystemInfoWriter.java
index 5662a3992ae..d6a59d032ff 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/AbstractSystemInfoWriter.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/AbstractSystemInfoWriter.java
@@ -25,7 +25,6 @@ import org.sonar.process.systeminfo.SystemInfoUtils;
import org.sonar.process.systeminfo.protobuf.ProtobufSystemInfo;
import org.sonar.server.health.Health;
import org.sonar.server.telemetry.TelemetryDataJsonWriter;
-import org.sonar.server.telemetry.TelemetryDataLoader;
public abstract class AbstractSystemInfoWriter implements SystemInfoWriter {
private static final String[] ORDERED_SECTION_NAMES = {
@@ -37,11 +36,9 @@ public abstract class AbstractSystemInfoWriter implements SystemInfoWriter {
"Compute Engine Tasks", "Compute Engine JVM State", "Compute Engine Database Connection", "Compute Engine Logging", "Compute Engine JVM Properties",
"Search State", "Search Indexes"};
- private final TelemetryDataLoader telemetry;
private final TelemetryDataJsonWriter dataJsonWriter;
- AbstractSystemInfoWriter(TelemetryDataLoader telemetry, TelemetryDataJsonWriter dataJsonWriter) {
- this.telemetry = telemetry;
+ AbstractSystemInfoWriter(TelemetryDataJsonWriter dataJsonWriter) {
this.dataJsonWriter = dataJsonWriter;
}
@@ -87,8 +84,4 @@ public abstract class AbstractSystemInfoWriter implements SystemInfoWriter {
json.name("Health Causes").beginArray().values(health.getCauses()).endArray();
}
- protected void writeTelemetry(JsonWriter json) {
- json.name("Statistics");
- dataJsonWriter.writeTelemetryData(json, telemetry.load());
- }
}
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/ClusterSystemInfoWriter.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/ClusterSystemInfoWriter.java
index ce07e5de50c..71f83793d51 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/ClusterSystemInfoWriter.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/ClusterSystemInfoWriter.java
@@ -37,8 +37,8 @@ public class ClusterSystemInfoWriter extends AbstractSystemInfoWriter {
private final HealthChecker healthChecker;
public ClusterSystemInfoWriter(GlobalInfoLoader globalInfoLoader, AppNodesInfoLoader appNodesInfoLoader, SearchNodesInfoLoader searchNodesInfoLoader,
- HealthChecker healthChecker, TelemetryDataLoader telemetry, TelemetryDataJsonWriter dataJsonWriter) {
- super(telemetry, dataJsonWriter);
+ HealthChecker healthChecker, TelemetryDataJsonWriter dataJsonWriter) {
+ super(dataJsonWriter);
this.globalInfoLoader = globalInfoLoader;
this.appNodesInfoLoader = appNodesInfoLoader;
this.searchNodesInfoLoader = searchNodesInfoLoader;
@@ -52,7 +52,6 @@ public class ClusterSystemInfoWriter extends AbstractSystemInfoWriter {
writeGlobalSections(json);
writeApplicationNodes(json, clusterHealth);
writeSearchNodes(json, clusterHealth);
- writeTelemetry(json);
}
private void writeGlobalSections(JsonWriter json) {
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/StandaloneSystemInfoWriter.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/StandaloneSystemInfoWriter.java
index c4e7386b2e0..f5762f4602f 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/StandaloneSystemInfoWriter.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/StandaloneSystemInfoWriter.java
@@ -37,9 +37,9 @@ public class StandaloneSystemInfoWriter extends AbstractSystemInfoWriter {
private final HealthChecker healthChecker;
private final SystemInfoSection[] systemInfoSections;
- public StandaloneSystemInfoWriter(TelemetryDataLoader telemetry, CeHttpClient ceHttpClient, HealthChecker healthChecker,
+ public StandaloneSystemInfoWriter(CeHttpClient ceHttpClient, HealthChecker healthChecker,
TelemetryDataJsonWriter dataJsonWriter, SystemInfoSection... systemInfoSections) {
- super(telemetry, dataJsonWriter);
+ super(dataJsonWriter);
this.ceHttpClient = ceHttpClient;
this.healthChecker = healthChecker;
this.systemInfoSections = systemInfoSections;
@@ -56,7 +56,6 @@ public class StandaloneSystemInfoWriter extends AbstractSystemInfoWriter {
.ifPresent(ce -> sections.addAll(ce.getSectionsList()));
writeSections(sections, json);
- writeTelemetry(json);
}
private void writeHealth(JsonWriter json) {
diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/ClusterSystemInfoWriterTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/ClusterSystemInfoWriterTest.java
index e93104388e9..93b09849b45 100644
--- a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/ClusterSystemInfoWriterTest.java
+++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/ClusterSystemInfoWriterTest.java
@@ -23,7 +23,6 @@ import java.io.StringWriter;
import java.util.Collections;
import org.junit.Before;
import org.junit.Test;
-import org.mockito.Mockito;
import org.sonar.api.utils.text.JsonWriter;
import org.sonar.process.systeminfo.protobuf.ProtobufSystemInfo.Attribute;
import org.sonar.process.systeminfo.protobuf.ProtobufSystemInfo.Section;
@@ -35,7 +34,6 @@ import org.sonar.server.platform.monitoring.cluster.GlobalInfoLoader;
import org.sonar.server.platform.monitoring.cluster.NodeInfo;
import org.sonar.server.platform.monitoring.cluster.SearchNodesInfoLoader;
import org.sonar.server.telemetry.TelemetryDataJsonWriter;
-import org.sonar.server.telemetry.TelemetryDataLoader;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
@@ -46,10 +44,9 @@ public class ClusterSystemInfoWriterTest {
private final AppNodesInfoLoader appNodesInfoLoader = mock(AppNodesInfoLoader.class);
private final SearchNodesInfoLoader searchNodesInfoLoader = mock(SearchNodesInfoLoader.class);
private final HealthChecker healthChecker = mock(HealthChecker.class);
- private final TelemetryDataLoader telemetry = mock(TelemetryDataLoader.class, Mockito.RETURNS_MOCKS);
private final TelemetryDataJsonWriter dataJsonWriter = new TelemetryDataJsonWriter();
private final ClusterSystemInfoWriter underTest = new ClusterSystemInfoWriter(globalInfoLoader, appNodesInfoLoader,
- searchNodesInfoLoader, healthChecker, telemetry, dataJsonWriter);
+ searchNodesInfoLoader, healthChecker, dataJsonWriter);
@Before
public void before() throws InterruptedException {
@@ -71,11 +68,7 @@ public class ClusterSystemInfoWriterTest {
assertThat(writer).hasToString("{\"Health\":\"GREEN\","
+ "\"Health Causes\":[],\"\":{\"name\":\"globalInfo\"},"
+ "\"Application Nodes\":[{\"Name\":\"appNodes\",\"\":{\"name\":\"appNodes\"}}],"
- + "\"Search Nodes\":[{\"Name\":\"searchNodes\",\"\":{\"name\":\"searchNodes\"}}],"
- + "\"Statistics\":{\"id\":\"\",\"version\":\"\",\"database\":{\"name\":\"\",\"version\":\"\"},\"plugins\":[],"
- + "\"userCount\":0,\"projectCount\":0,\"usingBranches\":false,\"ncloc\":0,\"projectCountByLanguage\":[],"
- + "\"nclocByLanguage\":[],\"almIntegrationCount\":[],\"externalAuthProviders\":[],\"projectCountByScm\":[],\"projectCountByCI\":[],\"sonarlintWeeklyUsers\":0,"
- + "\"installationDate\":0,\"installationVersion\":\"\",\"docker\":false}}");
+ + "\"Search Nodes\":[{\"Name\":\"searchNodes\",\"\":{\"name\":\"searchNodes\"}}]}");
}
private static NodeInfo createNodeInfo(String name) {
diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/StandaloneSystemInfoWriterTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/StandaloneSystemInfoWriterTest.java
index 32397beb39a..f8b400e943b 100644
--- a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/StandaloneSystemInfoWriterTest.java
+++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/StandaloneSystemInfoWriterTest.java
@@ -49,9 +49,8 @@ public class StandaloneSystemInfoWriterTest {
private final SystemInfoSection section2 = mock(SystemInfoSection.class);
private final CeHttpClient ceHttpClient = mock(CeHttpClientImpl.class, Mockito.RETURNS_MOCKS);
private final TestStandaloneHealthChecker healthChecker = new TestStandaloneHealthChecker();
- private final TelemetryDataLoader telemetry = mock(TelemetryDataLoader.class, Mockito.RETURNS_MOCKS);
private final TelemetryDataJsonWriter dataJsonWriter = new TelemetryDataJsonWriter();
- private final StandaloneSystemInfoWriter underTest = new StandaloneSystemInfoWriter(telemetry, ceHttpClient, healthChecker, dataJsonWriter, section1, section2);
+ private final StandaloneSystemInfoWriter underTest = new StandaloneSystemInfoWriter(ceHttpClient, healthChecker, dataJsonWriter, section1, section2);
@Test
public void write_json() {
@@ -75,10 +74,7 @@ public class StandaloneSystemInfoWriterTest {
underTest.write(jsonWriter);
jsonWriter.endObject();
// response does not contain empty "Section Three"
- assertThat(writer).hasToString("{\"Health\":\"GREEN\",\"Health Causes\":[],\"Section One\":{\"foo\":\"bar\"},\"Section Two\":{\"one\":1,\"two\":2}," +
- "\"Statistics\":{\"id\":\"\",\"version\":\"\",\"database\":{\"name\":\"\",\"version\":\"\"},\"plugins\":[],\"userCount\":0,\"projectCount\":0,\"usingBranches\":false," +
- "\"ncloc\":0,\"projectCountByLanguage\":[],\"nclocByLanguage\":[],\"almIntegrationCount\":[],\"externalAuthProviders\":[],\"projectCountByScm\":[],"
- + "\"projectCountByCI\":[],\"sonarlintWeeklyUsers\":0,\"installationDate\":0,\"installationVersion\":\"\",\"docker\":false}}");
+ assertThat(writer).hasToString("{\"Health\":\"GREEN\",\"Health Causes\":[],\"Section One\":{\"foo\":\"bar\"},\"Section Two\":{\"one\":1,\"two\":2}}");
}
private void logInAsSystemAdministrator() {