Refactoring: move statistics report to appending (based on IDEA-CR-39591)

This commit is contained in:
Shaverdova Elena
2018-11-09 16:15:07 +01:00
parent 38e70a99ef
commit 2763b812e5
2 changed files with 7 additions and 3 deletions
@@ -2,7 +2,6 @@
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;
@@ -60,7 +59,6 @@ public class DefaultIdeaErrorLogger implements ErrorLogger {
boolean isOOM = getOOMErrorKind(event.getThrowable()) != null;
boolean isMappingFailed = !isOOM && event.getThrowable() instanceof MappingFailedException;
AppLifecycleUsageTriggerCollector.onError(isOOM, isMappingFailed);
return notificationEnabled ||
showPluginError ||
@@ -105,7 +103,7 @@ public class DefaultIdeaErrorLogger implements ErrorLogger {
}
@Nullable
private static MemoryKind getOOMErrorKind(Throwable t) {
static MemoryKind getOOMErrorKind(Throwable t) {
String message = t.getMessage();
if (t instanceof OutOfMemoryError) {
@@ -1,6 +1,7 @@
// 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.featureStatistics.fusCollectors.AppLifecycleUsageTriggerCollector;
import com.intellij.idea.IdeaApplication;
import com.intellij.idea.Main;
import com.intellij.openapi.application.Application;
@@ -10,6 +11,7 @@ import com.intellij.openapi.diagnostic.ExceptionWithAttachments;
import com.intellij.openapi.diagnostic.IdeaLoggingEvent;
import com.intellij.openapi.diagnostic.RuntimeExceptionWithAttachments;
import com.intellij.util.ExceptionUtil;
import com.intellij.util.io.MappingFailedException;
import org.apache.log4j.AppenderSkeleton;
import org.apache.log4j.Level;
import org.apache.log4j.spi.LoggingEvent;
@@ -92,6 +94,10 @@ public class DialogAppender extends AppenderSkeleton {
ideaEvent = extractLoggingEvent(messageObject, info.getThrowable());
}
boolean isOOM = DefaultIdeaErrorLogger.getOOMErrorKind(ideaEvent.getThrowable()) != null;
boolean isMappingFailed = !isOOM && ideaEvent.getThrowable() instanceof MappingFailedException;
AppLifecycleUsageTriggerCollector.onError(isOOM, isMappingFailed);
for (int i = errorLoggers.length - 1; i >= 0; i--) {
ErrorLogger logger = errorLoggers[i];
if (!logger.canHandle(ideaEvent)) {