mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-265654: migrate external.project.task group to StructuredIdeActivity
GitOrigin-RevId: 640e70ab7ae27ce096155ec3b6b8950ac9ddff30
This commit is contained in:
committed by
intellij-monorepo-bot
parent
c6cdfa0e26
commit
a080ea283a
@@ -114,7 +114,7 @@
|
||||
<externalSystemWorkspaceContributor implementation="com.intellij.openapi.externalSystem.importing.JpsDependencyContributor"/>
|
||||
<projectService serviceImplementation="com.intellij.openapi.externalSystem.importing.GAVStateComponent"/>
|
||||
|
||||
<statistics.counterUsagesCollector groupId="external.project.task" version="1"/>
|
||||
<statistics.counterUsagesCollector implementationClass="com.intellij.openapi.externalSystem.statistics.ExternalSystemTaskCollector"/>
|
||||
<statistics.projectUsagesCollector implementation="com.intellij.openapi.externalSystem.statistics.ExternalSystemUsagesCollector"/>
|
||||
<statistics.projectUsagesCollector implementation="com.intellij.openapi.externalSystem.statistics.ExternalSystemSettingsCollector"/>
|
||||
<statistics.counterUsagesCollector implementationClass="com.intellij.openapi.externalSystem.statistics.ExternalSystemActionsCollector"/>
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
// Copyright 2000-2020 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.openapi.externalSystem.service.internal;
|
||||
|
||||
import com.intellij.internal.statistic.IdeActivity;
|
||||
import com.intellij.internal.statistic.StructuredIdeActivity;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.externalSystem.model.ProjectSystemId;
|
||||
import com.intellij.openapi.externalSystem.model.execution.ExternalSystemTaskExecutionSettings;
|
||||
@@ -126,7 +126,7 @@ public class ExternalSystemExecuteTaskTask extends AbstractExternalSystemTask {
|
||||
throw e;
|
||||
}
|
||||
|
||||
IdeActivity activity =
|
||||
StructuredIdeActivity activity =
|
||||
externalSystemTaskStarted(getIdeProject(), getExternalSystemId(), ExecuteTask, environmentConfigurationProvider);
|
||||
try {
|
||||
taskManager.executeTasks(id, myTasksToExecute, projectPath, settings, myJvmParametersSetup);
|
||||
|
||||
+3
-3
@@ -1,9 +1,8 @@
|
||||
// Copyright 2000-2020 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.openapi.externalSystem.service.internal;
|
||||
|
||||
import com.intellij.internal.statistic.IdeActivity;
|
||||
import com.intellij.internal.statistic.StructuredIdeActivity;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.Experiments;
|
||||
import com.intellij.openapi.externalSystem.ExternalSystemManager;
|
||||
import com.intellij.openapi.externalSystem.importing.ImportSpec;
|
||||
import com.intellij.openapi.externalSystem.importing.ImportSpecImpl;
|
||||
@@ -110,7 +109,8 @@ public class ExternalSystemResolveProjectTask extends AbstractExternalSystemTask
|
||||
throw e;
|
||||
}
|
||||
|
||||
IdeActivity activity = externalSystemTaskStarted(ideProject, getExternalSystemId(), ResolveProject, environmentConfigurationProvider);
|
||||
StructuredIdeActivity activity =
|
||||
externalSystemTaskStarted(ideProject, getExternalSystemId(), ResolveProject, environmentConfigurationProvider);
|
||||
try {
|
||||
DataNode<ProjectData> project = resolver.resolveProjectInfo(id, myProjectPath, myIsPreviewMode, settings, myResolverPolicy);
|
||||
if (project != null) {
|
||||
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
// 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.openapi.externalSystem.statistics
|
||||
|
||||
import com.intellij.execution.impl.statistics.RunConfigurationUsageTriggerCollector
|
||||
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
|
||||
import com.intellij.openapi.externalSystem.statistics.ExternalSystemActionsCollector.Companion.EXTERNAL_SYSTEM_ID
|
||||
|
||||
class ExternalSystemTaskCollector : CounterUsagesCollector() {
|
||||
companion object {
|
||||
val GROUP = EventLogGroup("external.project.task", 2)
|
||||
|
||||
@JvmField
|
||||
val TASK_ID_FIELD = EventFields.Enum<ExternalSystemUsagesCollector.ExternalSystemTaskId>("task_id")
|
||||
|
||||
@JvmField
|
||||
val TARGET_FIELD = EventFields.StringValidatedByCustomRule("target", RunConfigurationUsageTriggerCollector.RunTargetValidator.RULE_ID)
|
||||
|
||||
|
||||
@JvmField
|
||||
val EXTERNAL_TASK_ACTIVITY = IdeActivityGroup(GROUP, startEventAdditionalFields = arrayOf(TASK_ID_FIELD,
|
||||
TARGET_FIELD,
|
||||
EXTERNAL_SYSTEM_ID))
|
||||
|
||||
//@JvmField
|
||||
//val INDEXING_STAGE = INDEXING_ACTIVITY.registerStage("stage", arrayOf(STAGE_CLASS))
|
||||
}
|
||||
|
||||
override fun getGroup(): EventLogGroup {
|
||||
return GROUP
|
||||
}
|
||||
}
|
||||
|
||||
+13
-14
@@ -1,18 +1,19 @@
|
||||
// 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.openapi.externalSystem.statistics
|
||||
|
||||
import com.intellij.execution.impl.statistics.RunConfigurationUsageTriggerCollector
|
||||
import com.intellij.internal.statistic.IdeActivity
|
||||
import com.intellij.internal.statistic.StructuredIdeActivity
|
||||
import com.intellij.internal.statistic.beans.MetricEvent
|
||||
import com.intellij.internal.statistic.beans.newMetric
|
||||
import com.intellij.internal.statistic.eventLog.events.EventFields
|
||||
import com.intellij.internal.statistic.eventLog.events.EventFields.StringValidatedByCustomRule
|
||||
import com.intellij.internal.statistic.eventLog.events.EventPair
|
||||
import com.intellij.internal.statistic.service.fus.collectors.ProjectUsagesCollector
|
||||
import com.intellij.openapi.externalSystem.ExternalSystemModulePropertyManager
|
||||
import com.intellij.openapi.externalSystem.model.ProjectSystemId
|
||||
import com.intellij.openapi.externalSystem.service.execution.ExternalSystemJdkUtil
|
||||
import com.intellij.openapi.externalSystem.service.execution.TargetEnvironmentConfigurationProvider
|
||||
import com.intellij.openapi.externalSystem.statistics.ExternalSystemActionsCollector.Companion.EXTERNAL_SYSTEM_ID
|
||||
import com.intellij.openapi.externalSystem.statistics.ExternalSystemTaskCollector.Companion.EXTERNAL_TASK_ACTIVITY
|
||||
import com.intellij.openapi.externalSystem.statistics.ExternalSystemTaskCollector.Companion.TARGET_FIELD
|
||||
import com.intellij.openapi.externalSystem.statistics.ExternalSystemTaskCollector.Companion.TASK_ID_FIELD
|
||||
import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil
|
||||
import com.intellij.openapi.module.ModuleManager
|
||||
import com.intellij.openapi.project.Project
|
||||
@@ -24,8 +25,8 @@ class ExternalSystemUsagesCollector : ProjectUsagesCollector() {
|
||||
override fun getMetrics(project: Project): Set<MetricEvent> {
|
||||
val usages = mutableSetOf<MetricEvent>()
|
||||
for (manager in ExternalSystemApiUtil.getAllManagers()) {
|
||||
if (!manager.getSettingsProvider().`fun`(project).getLinkedProjectsSettings().isEmpty()) {
|
||||
usages.add(newMetric("externalSystemId", getAnonymizedSystemId(manager.getSystemId())))
|
||||
if (!manager.settingsProvider.`fun`(project).linkedProjectsSettings.isEmpty()) {
|
||||
usages.add(newMetric("externalSystemId", getAnonymizedSystemId(manager.systemId)))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,9 +42,6 @@ class ExternalSystemUsagesCollector : ProjectUsagesCollector() {
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val TASK_ID_FIELD = EventFields.Enum<ExternalSystemTaskId>("task_id")
|
||||
private val TARGET_FIELD = StringValidatedByCustomRule("target", RunConfigurationUsageTriggerCollector.RunTargetValidator.RULE_ID)
|
||||
|
||||
fun getJRETypeUsage(key: String, jreName: String?): MetricEvent {
|
||||
val anonymizedName = when {
|
||||
jreName.isNullOrBlank() -> "empty"
|
||||
@@ -68,13 +66,14 @@ class ExternalSystemUsagesCollector : ProjectUsagesCollector() {
|
||||
fun externalSystemTaskStarted(project: Project?,
|
||||
systemId: ProjectSystemId?,
|
||||
taskId: ExternalSystemTaskId,
|
||||
environmentConfigurationProvider: TargetEnvironmentConfigurationProvider?): IdeActivity {
|
||||
return IdeActivity(project, "external.project.task").startedWithData { data ->
|
||||
addExternalSystemId(data, systemId);
|
||||
EventPair(TASK_ID_FIELD, taskId).addData(data)
|
||||
environmentConfigurationProvider: TargetEnvironmentConfigurationProvider?): StructuredIdeActivity {
|
||||
return StructuredIdeActivity(project, EXTERNAL_TASK_ACTIVITY).started {
|
||||
val data: MutableList<EventPair<*>> = mutableListOf(EXTERNAL_SYSTEM_ID.with(anonymizeSystemId(systemId)))
|
||||
data.add(TASK_ID_FIELD.with(taskId))
|
||||
environmentConfigurationProvider?.environmentConfiguration?.typeId?.also {
|
||||
EventPair(TARGET_FIELD, it).addData(data)
|
||||
data.add(TARGET_FIELD.with(it))
|
||||
}
|
||||
data
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user