From bb3880c4d446bc6505cb810b15708d7742c807d4 Mon Sep 17 00:00:00 2001 From: Andrea Selva Date: Thu, 29 Dec 2022 13:18:46 +0100 Subject: [PATCH] Fixed JSON payload in telemetry reporting (#701) --- .../src/main/java/io/moquette/broker/Server.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/broker/src/main/java/io/moquette/broker/Server.java b/broker/src/main/java/io/moquette/broker/Server.java index 8210dd900..eb72aca1b 100644 --- a/broker/src/main/java/io/moquette/broker/Server.java +++ b/broker/src/main/java/io/moquette/broker/Server.java @@ -283,19 +283,19 @@ private String collectTelemetryData(String uuid) { final String maxHeap = maxMemory == Long.MAX_VALUE ? "undefined" : Long.toString(maxMemory); return String.format( - "{\"os\": %s, " + - "\"cpu_arch\": %s, " + - "\"jvm_version\": %s, " + - "\"jvm_vendor\": %s, " + - "\"broker_version\": %s, " + + "{\"os\": \"%s\", " + + "\"cpu_arch\": \"%s\", " + + "\"jvm_version\": \"%s\", " + + "\"jvm_vendor\": \"%s\", " + + "\"broker_version\": \"%s\", " + "\"standalone\": %s," + - "\"max_heap\": %s" + - "\"uuid\": %s}", + "\"max_heap\": \"%s\", " + + "\"uuid\": \"%s\"}", os, cpuArch, jvmVersion, jvmVendor, MOQUETTE_VERSION, this.standalone, maxHeap, uuid); } private void sendTelemetryData(String telemetryDoc) throws IOException { - URL url = new URL("http://telemetry.moquette.io/api/v1/notify"); + URL url = new URL("https://telemetry.moquette.io/api/v1/notify"); HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("Content-Type", "application/json");