statistics: report how many exceptions are thrown by plugins (FUS-189)

This commit is contained in:
nik
2018-11-09 11:22:52 +03:00
parent b85bbabbd4
commit ce8074fefd
4 changed files with 25 additions and 3 deletions
@@ -3,6 +3,8 @@ package com.intellij.diagnostic;
import com.intellij.diagnostic.VMOptions.MemoryKind;
import com.intellij.featureStatistics.fusCollectors.AppLifecycleUsageTriggerCollector;
import com.intellij.ide.plugins.PluginManagerCore;
import com.intellij.internal.statistic.service.fus.collectors.FUSApplicationUsageTrigger;
import com.intellij.notification.Notification;
import com.intellij.notification.NotificationType;
import com.intellij.notification.Notifications;
@@ -12,6 +14,7 @@ import com.intellij.openapi.application.ex.ApplicationManagerEx;
import com.intellij.openapi.diagnostic.ErrorLogger;
import com.intellij.openapi.diagnostic.ErrorReportSubmitter;
import com.intellij.openapi.diagnostic.IdeaLoggingEvent;
import com.intellij.openapi.extensions.PluginId;
import com.intellij.openapi.updateSettings.impl.UpdateChecker;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.util.io.MappingFailedException;
@@ -46,7 +49,13 @@ public class DefaultIdeaErrorLogger implements ErrorLogger {
boolean notificationEnabled = !DISABLED_VALUE.equals(System.getProperty(FATAL_ERROR_NOTIFICATION_PROPERTY, ENABLED_VALUE));
ErrorReportSubmitter submitter = IdeErrorsDialog.getSubmitter(event.getThrowable());
Throwable t = event.getThrowable();
PluginId pluginId = IdeErrorsDialog.findPluginId(t);
if (pluginId != null && !pluginId.getIdString().equals(PluginManagerCore.CORE_PLUGIN_ID)) {
FUSApplicationUsageTrigger.getInstance().trigger(PluginExceptionStatisticCollector.class, pluginId.getIdString(), null);
}
ErrorReportSubmitter submitter = IdeErrorsDialog.getSubmitter(t, pluginId);
boolean showPluginError = !(submitter instanceof ITNReporter) || ((ITNReporter)submitter).showErrorInRelease(event);
boolean isOOM = getOOMErrorKind(event.getThrowable()) != null;
@@ -963,8 +963,7 @@ public class IdeErrorsDialog extends DialogWrapper implements MessagePoolListene
}
@Nullable
static ErrorReportSubmitter getSubmitter(@NotNull Throwable t) {
PluginId pluginId = findPluginId(t);
static ErrorReportSubmitter getSubmitter(@NotNull Throwable t, PluginId pluginId) {
IdeaPluginDescriptor plugin = PluginManager.getPlugin(pluginId);
return getSubmitter(t, pluginId, plugin);
}
@@ -0,0 +1,13 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.diagnostic;
import com.intellij.internal.statistic.service.fus.collectors.ApplicationUsageTriggerCollector;
import org.jetbrains.annotations.NotNull;
public class PluginExceptionStatisticCollector extends ApplicationUsageTriggerCollector {
@NotNull
@Override
public String getGroupId() {
return "statistics.plugins.exception";
}
}
@@ -449,6 +449,7 @@
<statistics.applicationUsagesCollector implementation="com.intellij.featureStatistics.fusCollectors.AppLifecycleUsageTriggerCollector"/>
<statistics.applicationUsagesCollector implementation="com.intellij.featureStatistics.fusCollectors.EAPUsageCollector"/>
<statistics.applicationUsagesCollector implementation="com.intellij.openapi.updateSettings.impl.IdeUpdateUsageTriggerCollector"/>
<statistics.applicationUsagesCollector implementation="com.intellij.diagnostic.PluginExceptionStatisticCollector"/>
<statistic.eventLog.fusEventLoggerProvider implementation="com.intellij.internal.statistic.eventLog.FeatureUsageFileEventLoggerProvider"/>
<statistic.eventLog.fusStateEventTracker implementation="com.intellij.internal.statistic.eventLog.SystemStateMonitor"/>
<statistic.eventLog.fusStateEventTracker implementation="com.intellij.configurationStore.statistic.eventLog.FeatureUsageSettingsEventScheduler"/>