OPENIDE added os information (in query params) to send statistics url

(cherry picked from commit 121380ec96ea84871f33ad0a3ec4f79071d6a51e)
This commit is contained in:
Nikita Iarychenko
2025-02-07 10:35:22 +04:00
parent e4517868e5
commit 289edef8e8
3 changed files with 45 additions and 7 deletions

View File

@@ -15,6 +15,7 @@ import com.intellij.openapi.util.registry.Registry
import com.intellij.platform.eel.EelApi
import com.intellij.ui.CollectionComboBoxModel
import com.intellij.ui.DocumentAdapter
import com.intellij.ui.SimpleTextAttributes
import com.intellij.ui.components.textFieldWithBrowseButton
import com.intellij.ui.dsl.builder.AlignX
import com.intellij.ui.dsl.builder.Cell
@@ -112,7 +113,10 @@ private class JdkVersionVendorCombobox: ComboBox<JdkVersionVendorItem>() {
renderer = listCellRenderer<JdkVersionVendorItem>("") {
val title = value.item.product.packagePresentationText.replace("Axiom JSC", "").trim()
text(title)
val style = if (isLicenseAcceptedJDK(value)) SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES else SimpleTextAttributes.REGULAR_ATTRIBUTES
text(title) {
this.attributes = style
}
text(value.item.jdkVersion) {
foreground = greyForeground

View File

@@ -18,7 +18,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;

View File

@@ -10,11 +10,11 @@ import com.intellij.internal.statistic.eventLog.EventLogBuild;
import com.intellij.internal.statistic.eventLog.connection.metadata.EventGroupsFilterRules;
import com.intellij.internal.statistic.eventLog.connection.metadata.EventLogMetadataUtils;
import com.intellij.internal.statistic.eventLog.filters.*;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
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 +48,41 @@ public class EventLogUploadSettingsService extends SettingsConnectionService imp
@Override
public @Nullable 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