From 095a4cba4a4f87c73241aaa6901ff9d7ff26a9e6 Mon Sep 17 00:00:00 2001 From: "Svetlana.Zemlyanskaya" Date: Thu, 24 Jan 2019 13:07:00 +0100 Subject: [PATCH] FUS: report os and java versions as context --- .../statistic/eventLog/SystemStateMonitor.kt | 14 ++++++-------- .../fus/collectors/FUStateUsagesLogger.java | 6 ++++++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/eventLog/SystemStateMonitor.kt b/platform/platform-impl/src/com/intellij/internal/statistic/eventLog/SystemStateMonitor.kt index f6c79d8011c4..49249ba4513b 100644 --- a/platform/platform-impl/src/com/intellij/internal/statistic/eventLog/SystemStateMonitor.kt +++ b/platform/platform-impl/src/com/intellij/internal/statistic/eventLog/SystemStateMonitor.kt @@ -3,15 +3,14 @@ package com.intellij.internal.statistic.eventLog import com.intellij.concurrency.JobScheduler import com.intellij.internal.statistic.collectors.fus.os.OsVersionUsageCollector +import com.intellij.internal.statistic.service.fus.collectors.FUStateUsagesLogger import com.intellij.openapi.util.SystemInfo import com.intellij.util.lang.JavaVersion import java.util.concurrent.TimeUnit class SystemStateMonitor : FeatureUsageStateEventTracker { - private val OS_NAME = FeatureUsageGroup("system.os.name", 1) - private val OS_VERSION = FeatureUsageGroup("system.os.version", 1) - private val JVM_VENDOR = FeatureUsageGroup("system.jvm.vendor", 1) - private val JVM_VERSION = FeatureUsageGroup("system.jvm.version", 1) + private val OS_GROUP = FeatureUsageGroup("system.os", 1) + private val JAVA_GROUP = FeatureUsageGroup("system.java", 1) private val INITIAL_DELAY = 0 private val PERIOD_DELAY = 24 * 60 @@ -28,11 +27,10 @@ class SystemStateMonitor : FeatureUsageStateEventTracker { } private fun logSystemEvent() { - FeatureUsageLogger.logState(OS_NAME, getOSName()) - FeatureUsageLogger.logState(OS_VERSION, getOSVersion()) + FUStateUsagesLogger.logStateEvent(OS_GROUP, getOSName(), FeatureUsageDataBuilder().addData("version", getOSVersion())) - FeatureUsageLogger.logState(JVM_VENDOR, System.getProperty("java.vendor", "Unknown")) - FeatureUsageLogger.logState(JVM_VERSION, "1." + JavaVersion.current().feature) + val data = FeatureUsageDataBuilder().addData("version", "1." + JavaVersion.current().feature) + FUStateUsagesLogger.logStateEvent(JAVA_GROUP, System.getProperty("java.vendor", "Unknown"), data) } private fun getOSName() : String { diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/service/fus/collectors/FUStateUsagesLogger.java b/platform/platform-impl/src/com/intellij/internal/statistic/service/fus/collectors/FUStateUsagesLogger.java index 5070223f5960..326c36e92321 100644 --- a/platform/platform-impl/src/com/intellij/internal/statistic/service/fus/collectors/FUStateUsagesLogger.java +++ b/platform/platform-impl/src/com/intellij/internal/statistic/service/fus/collectors/FUStateUsagesLogger.java @@ -3,6 +3,7 @@ package com.intellij.internal.statistic.service.fus.collectors; import com.intellij.internal.statistic.beans.UsageDescriptor; import com.intellij.internal.statistic.eventLog.EventLogExternalSettingsService; +import com.intellij.internal.statistic.eventLog.FeatureUsageDataBuilder; import com.intellij.internal.statistic.eventLog.FeatureUsageGroup; import com.intellij.internal.statistic.eventLog.FeatureUsageLogger; import com.intellij.internal.statistic.utils.StatisticsUtilKt; @@ -72,4 +73,9 @@ public class FUStateUsagesLogger implements UsagesCollectorConsumer { } logger.logState(group, INVOKED); } + + public static void logStateEvent(@NotNull FeatureUsageGroup group, @NotNull String event, @NotNull FeatureUsageDataBuilder data) { + FeatureUsageLogger.INSTANCE.logState(group, event, data.createData()); + FeatureUsageLogger.INSTANCE.logState(group, INVOKED); + } }