IDEA-265654: migrate build group to StructuredIdeActivity

GitOrigin-RevId: b7117a59bb32d93f37df984fb1245654faf62b73
This commit is contained in:
Anastasia Ivanova
2021-04-15 04:50:22 +03:00
committed by intellij-monorepo-bot
parent b6baad842a
commit 38c01a9ef0
3 changed files with 32 additions and 7 deletions
@@ -2,7 +2,7 @@
package com.intellij.task.impl;
import com.intellij.execution.ExecutionException;
import com.intellij.internal.statistic.IdeActivity;
import com.intellij.internal.statistic.StructuredIdeActivity;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.application.ReadAction;
@@ -41,6 +41,8 @@ import java.util.function.BiPredicate;
import java.util.function.Consumer;
import java.util.function.Supplier;
import static com.intellij.task.impl.ProjectTaskManagerStatisticsCollector.BUILD_ACTIVITY;
import static com.intellij.task.impl.ProjectTaskManagerStatisticsCollector.TASK_RUNNER;
import static com.intellij.util.containers.ContainerUtil.emptyList;
import static com.intellij.util.containers.ContainerUtil.map;
import static java.util.Arrays.stream;
@@ -179,9 +181,9 @@ public final class ProjectTaskManagerImpl extends ProjectTaskManager {
});
IdeActivity activity = new IdeActivity(myProject, "build").startedWithData(data -> {
data.addData("task_runner_class", map(toRun, it -> it.first.getClass().getName()));
});
StructuredIdeActivity activity = new StructuredIdeActivity(myProject, BUILD_ACTIVITY).started(() ->
Collections.singletonList(TASK_RUNNER.with(map(toRun, it -> it.first.getClass().getName())))
);
myEventPublisher.started(context);
@@ -357,7 +359,7 @@ public final class ProjectTaskManagerImpl extends ProjectTaskManager {
private final ProjectTaskContext myContext;
private final ResultConsumer myResultConsumer;
private final AtomicInteger myProgressCounter;
private final IdeActivity myActivity;
private final StructuredIdeActivity myActivity;
private final AtomicBoolean myErrorsFlag;
private final AtomicBoolean myAbortedFlag;
private final Map<ProjectTask, ProjectTaskState> myTasksState = new ConcurrentHashMap<>();
@@ -365,7 +367,7 @@ public final class ProjectTaskManagerImpl extends ProjectTaskManager {
private ProjectTaskResultsAggregator(@NotNull ProjectTaskContext context,
@NotNull ResultConsumer resultConsumer,
int expectedResults,
@NotNull IdeActivity activity) {
@NotNull StructuredIdeActivity activity) {
myContext = context;
myResultConsumer = resultConsumer;
myProgressCounter = new AtomicInteger(expectedResults);
@@ -0,0 +1,23 @@
// Copyright 2000-2021 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.task.impl
import com.intellij.internal.statistic.IdeActivityGroup
import com.intellij.internal.statistic.eventLog.EventLogGroup
import com.intellij.internal.statistic.eventLog.events.EventFields
import com.intellij.internal.statistic.service.fus.collectors.CounterUsagesCollector
class ProjectTaskManagerStatisticsCollector : CounterUsagesCollector() {
companion object {
val GROUP = EventLogGroup("build", 4)
@JvmField
val TASK_RUNNER = EventFields.StringListValidatedByCustomRule("task_runner_class","class_name")
@JvmField
val BUILD_ACTIVITY = IdeActivityGroup(GROUP, startEventAdditionalFields = arrayOf(TASK_RUNNER, EventFields.PluginInfo))
}
override fun getGroup(): EventLogGroup {
return GROUP
}
}
@@ -703,7 +703,7 @@
<statistics.counterUsagesCollector groupId="vfs" version="2"/>
<statistics.counterUsagesCollector groupId="indexing" version="3"/>
<statistics.counterUsagesCollector groupId="vcs" version="7"/>
<statistics.counterUsagesCollector groupId="build" version="3"/>
<statistics.counterUsagesCollector implementationClass="com.intellij.task.impl.ProjectTaskManagerStatisticsCollector"/>
<statistics.counterUsagesCollector groupId="project.import" version="3"/>
<statistics.counterUsagesCollector implementationClass="com.intellij.internal.statistic.service.fus.collectors.UIEventLogger"/>
<statistics.counterUsagesCollector groupId="plugins.advertiser" version="1"/>