mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
OPENIDE added os information (in query params) to send statistics url
This commit is contained in:
@@ -17,7 +17,7 @@ public class EventLogInternalApplicationInfo implements EventLogApplicationInfo
|
|||||||
private static final DataCollectorDebugLogger LOG =
|
private static final DataCollectorDebugLogger LOG =
|
||||||
new InternalDataCollectorDebugLogger(Logger.getInstance(EventLogStatisticsService.class));
|
new InternalDataCollectorDebugLogger(Logger.getInstance(EventLogStatisticsService.class));
|
||||||
// TODO [OpenIDE]: replace url
|
// 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 myIsTestSendEndpoint;
|
||||||
private final boolean myIsTestConfig;
|
private final boolean myIsTestConfig;
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ import com.intellij.internal.statistic.eventLog.connection.metadata.EventLogMeta
|
|||||||
import com.intellij.internal.statistic.eventLog.filters.*;
|
import com.intellij.internal.statistic.eventLog.filters.*;
|
||||||
import org.jetbrains.annotations.*;
|
import org.jetbrains.annotations.*;
|
||||||
|
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@ApiStatus.Internal
|
@ApiStatus.Internal
|
||||||
@@ -48,7 +51,41 @@ public class EventLogUploadSettingsService extends SettingsConnectionService imp
|
|||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public String getServiceUrl() {
|
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
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user