diff --git a/platform/statistics/src/com/intellij/internal/statistic/eventLog/EventLogInternalApplicationInfo.java b/platform/statistics/src/com/intellij/internal/statistic/eventLog/EventLogInternalApplicationInfo.java index df0df0cbaeac..0c7981b4ec1d 100644 --- a/platform/statistics/src/com/intellij/internal/statistic/eventLog/EventLogInternalApplicationInfo.java +++ b/platform/statistics/src/com/intellij/internal/statistic/eventLog/EventLogInternalApplicationInfo.java @@ -17,7 +17,7 @@ public class EventLogInternalApplicationInfo implements EventLogApplicationInfo private static final DataCollectorDebugLogger LOG = new InternalDataCollectorDebugLogger(Logger.getInstance(EventLogStatisticsService.class)); // TODO [OpenIDE]: replace url - public static final String EVENT_LOG_SETTINGS_URL_TEMPLATE = ""; + public static final String EVENT_LOG_SETTINGS_URL_TEMPLATE = "https://stats.openide.ru/storage/fus/config/v4/%s/%s.json"; private final boolean myIsTestSendEndpoint; private final boolean myIsTestConfig; diff --git a/platform/statistics/uploader/src/com/intellij/internal/statistic/eventLog/connection/EventLogUploadSettingsService.java b/platform/statistics/uploader/src/com/intellij/internal/statistic/eventLog/connection/EventLogUploadSettingsService.java index 97fda75a4303..1df0020a08da 100644 --- a/platform/statistics/uploader/src/com/intellij/internal/statistic/eventLog/connection/EventLogUploadSettingsService.java +++ b/platform/statistics/uploader/src/com/intellij/internal/statistic/eventLog/connection/EventLogUploadSettingsService.java @@ -12,6 +12,9 @@ import com.intellij.internal.statistic.eventLog.connection.metadata.EventLogMeta import com.intellij.internal.statistic.eventLog.filters.*; import org.jetbrains.annotations.*; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Locale; import java.util.concurrent.TimeUnit; @ApiStatus.Internal @@ -48,7 +51,41 @@ public class EventLogUploadSettingsService extends SettingsConnectionService imp @Nullable @Override public String getServiceUrl() { - return getEndpointValue(SEND); + String value = getEndpointValue(SEND); + if (value != null) { + return value + "?" + QUERY_SUFFIX; + } + return null; + } + + private static String toValidQueryValue(String value) { + return URLEncoder.encode(value, StandardCharsets.UTF_8); + } + + private static final String QUERY_SUFFIX; + + // copy-paste from com.intellij.openapi.util.SystemInfo + static { + String name = System.getProperty("os.name"); + String version = System.getProperty("os.version").toLowerCase(Locale.ENGLISH); + + if (name.startsWith("Windows") && name.matches("Windows \\d+")) { + // for whatever reason, JRE reports "Windows 11" as a name and "10.0" as a version on Windows 11 + try { + String version2 = name.substring("Windows".length() + 1) + ".0"; + if (Float.parseFloat(version2) > Float.parseFloat(version)) { + version = version2; + } + } + catch (NumberFormatException ignored) { } + name = "Windows"; + } + + String QUERY_OS_NAME = toValidQueryValue(name); + String QUERY_OS_VERSION = toValidQueryValue(version); + String QUERY_OS_ARCH = toValidQueryValue(System.getProperty("os.arch")); + + QUERY_SUFFIX = "os_name=" + QUERY_OS_NAME + "&os_version=" + QUERY_OS_VERSION + "&os_arch=" + QUERY_OS_ARCH; } @Override