From dff3bfa1c6ff73aaf5314935ce90e1a98474d60f Mon Sep 17 00:00:00 2001 From: lukasz-jarocki-sonarsource Date: Tue, 22 Oct 2024 16:31:08 +0200 Subject: [PATCH] SONAR-23461 fixed an issue where telemetry for helm autoscaling and openshift was not sent --- .../org/sonar/telemetry/legacy/TelemetryDataJsonWriter.java | 2 ++ .../sonar/telemetry/legacy/TelemetryDataJsonWriterTest.java | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/server/sonar-telemetry/src/main/java/org/sonar/telemetry/legacy/TelemetryDataJsonWriter.java b/server/sonar-telemetry/src/main/java/org/sonar/telemetry/legacy/TelemetryDataJsonWriter.java index b186e15f059..37ab8e87f0e 100644 --- a/server/sonar-telemetry/src/main/java/org/sonar/telemetry/legacy/TelemetryDataJsonWriter.java +++ b/server/sonar-telemetry/src/main/java/org/sonar/telemetry/legacy/TelemetryDataJsonWriter.java @@ -278,6 +278,8 @@ public class TelemetryDataJsonWriter { json.prop("kubernetesVersion", cloudUsage.kubernetesVersion()); json.prop("kubernetesPlatform", cloudUsage.kubernetesPlatform()); json.prop("kubernetesProvider", cloudUsage.kubernetesProvider()); + json.prop("isHelmAutoscalingEnabled", cloudUsage.isHelmAutoscalingEnabled()); + json.prop("isOnOpenshift", cloudUsage.isOnOpenshift()); json.prop("officialHelmChart", cloudUsage.officialHelmChart()); json.prop("containerRuntime", cloudUsage.containerRuntime()); json.prop("officialImage", cloudUsage.officialImage()); diff --git a/server/sonar-telemetry/src/test/java/org/sonar/telemetry/legacy/TelemetryDataJsonWriterTest.java b/server/sonar-telemetry/src/test/java/org/sonar/telemetry/legacy/TelemetryDataJsonWriterTest.java index 1984cf4b041..fd4b3cbd684 100644 --- a/server/sonar-telemetry/src/test/java/org/sonar/telemetry/legacy/TelemetryDataJsonWriterTest.java +++ b/server/sonar-telemetry/src/test/java/org/sonar/telemetry/legacy/TelemetryDataJsonWriterTest.java @@ -298,13 +298,15 @@ class TelemetryDataJsonWriterTest { TelemetryData data = telemetryBuilder().build(); String json = writeTelemetryData(data); - assertJson(json).isSimilarTo(""" + assertJson(json).withStrictArrayOrder().isSimilarTo(""" { "cloudUsage": { "kubernetes": true, "kubernetesVersion": "1.27", "kubernetesPlatform": "linux/amd64", "kubernetesProvider": "5.4.181-99.354.amzn2.x86_64", + "isHelmAutoscalingEnabled": true, + "isOnOpenshift": false, "officialHelmChart": "10.1.0", "officialImage": false, "containerRuntime": "docker" @@ -701,7 +703,7 @@ class TelemetryDataJsonWriterTest { .setMessageSequenceNumber(1L) .setPlugins(Collections.emptyMap()) .setManagedInstanceInformation(new TelemetryData.ManagedInstanceInformation(false, null)) - .setCloudUsage(new TelemetryData.CloudUsage(true, "1.27", "linux/amd64", "5.4.181-99.354.amzn2.x86_64", "10.1.0", false, false, "docker", false)) + .setCloudUsage(new TelemetryData.CloudUsage(true, "1.27", "linux/amd64", "5.4.181-99.354.amzn2.x86_64", "10.1.0", false, true, "docker", false)) .setDatabase(new TelemetryData.Database("H2", "11")) .setNcdId(NCD_ID); } -- 2.39.5