mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
[git] IJPL-84816 Report clone depth in metrics
GitOrigin-RevId: e9a20d79aadaac8c38786ff0aef2c30302ff2b06
This commit is contained in:
committed by
intellij-monorepo-bot
parent
ca7bfcfe06
commit
08e08e8603
@@ -12696,7 +12696,7 @@ e:com.intellij.openapi.wm.impl.welcomeScreen.cloneableProjects.CloneableProjects
|
||||
com.intellij.openapi.wm.impl.welcomeScreen.cloneableProjects.CloneableProjectsService$CloneTask
|
||||
- a:run(com.intellij.openapi.progress.ProgressIndicator):com.intellij.openapi.wm.impl.welcomeScreen.cloneableProjects.CloneableProjectsService$CloneStatus
|
||||
- a:taskInfo():com.intellij.openapi.wm.impl.welcomeScreen.cloneableProjects.CloneableProjectsService$CloneTaskInfo
|
||||
f:com.intellij.openapi.wm.impl.welcomeScreen.cloneableProjects.CloneableProjectsService$CloneTaskInfo
|
||||
c:com.intellij.openapi.wm.impl.welcomeScreen.cloneableProjects.CloneableProjectsService$CloneTaskInfo
|
||||
- com.intellij.openapi.progress.TaskInfo
|
||||
- <init>(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String):V
|
||||
- f:getActionTitle():java.lang.String
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.intellij.CommonBundle
|
||||
import com.intellij.ide.RecentProjectMetaInfo
|
||||
import com.intellij.ide.RecentProjectsManager
|
||||
import com.intellij.ide.RecentProjectsManagerBase
|
||||
import com.intellij.internal.statistic.eventLog.events.EventPair
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.components.*
|
||||
import com.intellij.openapi.components.Service.Level
|
||||
@@ -21,6 +22,7 @@ import com.intellij.util.concurrency.annotations.RequiresEdt
|
||||
import com.intellij.util.containers.ContainerUtil
|
||||
import com.intellij.util.messages.Topic
|
||||
import com.intellij.util.messages.Topic.AppLevel
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
import org.jetbrains.annotations.CalledInAny
|
||||
import org.jetbrains.annotations.Nls
|
||||
import org.jetbrains.annotations.SystemIndependent
|
||||
@@ -39,7 +41,7 @@ class CloneableProjectsService {
|
||||
|
||||
ApplicationManager.getApplication().executeOnPooledThread {
|
||||
ProgressManager.getInstance().runProcess(Runnable {
|
||||
val activity = VcsCloneCollector.cloneStarted()
|
||||
val activity = VcsCloneCollector.cloneStarted(taskInfo)
|
||||
val cloneStatus: CloneStatus = try {
|
||||
cloneTask.run(progressIndicator)
|
||||
}
|
||||
@@ -50,7 +52,7 @@ class CloneableProjectsService {
|
||||
logger<CloneableProjectsService>().error(exception)
|
||||
CloneStatus.FAILURE
|
||||
}
|
||||
VcsCloneCollector.cloneFinished(activity, cloneStatus)
|
||||
VcsCloneCollector.cloneFinished(activity, cloneStatus, taskInfo)
|
||||
|
||||
when (cloneStatus) {
|
||||
CloneStatus.SUCCESS -> onSuccess(cloneableProject)
|
||||
@@ -171,7 +173,7 @@ class CloneableProjectsService {
|
||||
CANCEL
|
||||
}
|
||||
|
||||
class CloneTaskInfo(
|
||||
open class CloneTaskInfo(
|
||||
private val title: @NlsContexts.ProgressTitle String,
|
||||
private val cancelTooltipText: @Nls String,
|
||||
val actionTitle: @Nls String,
|
||||
@@ -179,12 +181,15 @@ class CloneableProjectsService {
|
||||
val failedTitle: @Nls String,
|
||||
val canceledTitle: @Nls String,
|
||||
val stopTitle: @Nls String,
|
||||
val stopDescription: @Nls String
|
||||
val stopDescription: @Nls String,
|
||||
) : TaskInfo {
|
||||
override fun getTitle(): String = title
|
||||
override fun getCancelText(): String = CommonBundle.getCancelButtonText()
|
||||
override fun getCancelTooltipText(): String = cancelTooltipText
|
||||
override fun isCancellable(): Boolean = true
|
||||
|
||||
@ApiStatus.Internal
|
||||
open fun getActivityData(): List<EventPair<*>> = emptyList()
|
||||
}
|
||||
|
||||
data class CloneableProject(
|
||||
|
||||
@@ -4,28 +4,35 @@ package com.intellij.openapi.wm.impl.welcomeScreen.cloneableProjects
|
||||
import com.intellij.internal.statistic.StructuredIdeActivity
|
||||
import com.intellij.internal.statistic.eventLog.EventLogGroup
|
||||
import com.intellij.internal.statistic.eventLog.events.EventFields
|
||||
import com.intellij.internal.statistic.eventLog.events.EventPair
|
||||
import com.intellij.internal.statistic.service.fus.collectors.CounterUsagesCollector
|
||||
import com.intellij.openapi.wm.impl.welcomeScreen.cloneableProjects.CloneableProjectsService.CloneStatus
|
||||
import com.intellij.openapi.wm.impl.welcomeScreen.cloneableProjects.CloneableProjectsService.CloneTaskInfo
|
||||
|
||||
internal object VcsCloneCollector : CounterUsagesCollector() {
|
||||
override fun getGroup(): EventLogGroup {
|
||||
return GROUP
|
||||
}
|
||||
|
||||
private val GROUP = EventLogGroup("vcs.clone", 1)
|
||||
|
||||
private val GROUP = EventLogGroup("vcs.clone", 2)
|
||||
private val CLONE_STATUS_EVENT_FIELD = EventFields.Enum("status", CloneStatus::class.java)
|
||||
|
||||
@JvmField
|
||||
internal val SHALLOW_CLONE_DEPTH = EventFields.Int("status")
|
||||
|
||||
private val CLONE_ACTIVITY = GROUP.registerIdeActivity(
|
||||
activityName = "cloning",
|
||||
finishEventAdditionalFields = arrayOf(CLONE_STATUS_EVENT_FIELD)
|
||||
)
|
||||
|
||||
fun cloneStarted(): StructuredIdeActivity {
|
||||
return CLONE_ACTIVITY.started(null)
|
||||
fun cloneStarted(cloneTaskInfo: CloneTaskInfo): StructuredIdeActivity {
|
||||
return CLONE_ACTIVITY.started(null) {
|
||||
cloneTaskInfo.getActivityData()
|
||||
}
|
||||
}
|
||||
|
||||
fun cloneFinished(activity: StructuredIdeActivity, cloneStatus: CloneStatus) {
|
||||
activity.finished { listOf(EventPair(CLONE_STATUS_EVENT_FIELD, cloneStatus)) }
|
||||
fun cloneFinished(activity: StructuredIdeActivity, cloneStatus: CloneStatus, cloneTaskInfo: CloneTaskInfo) {
|
||||
activity.finished {
|
||||
cloneTaskInfo.getActivityData() + CLONE_STATUS_EVENT_FIELD.with(cloneStatus)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package git4idea.checkout;
|
||||
|
||||
import com.intellij.dvcs.DvcsUtil;
|
||||
import com.intellij.dvcs.ui.DvcsBundle;
|
||||
import com.intellij.internal.statistic.eventLog.events.EventPair;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
@@ -24,6 +25,7 @@ import com.intellij.openapi.wm.impl.welcomeScreen.cloneableProjects.CloneablePro
|
||||
import com.intellij.openapi.wm.impl.welcomeScreen.cloneableProjects.CloneableProjectsService.CloneStatus;
|
||||
import com.intellij.openapi.wm.impl.welcomeScreen.cloneableProjects.CloneableProjectsService.CloneTask;
|
||||
import com.intellij.openapi.wm.impl.welcomeScreen.cloneableProjects.CloneableProjectsService.CloneTaskInfo;
|
||||
import com.intellij.openapi.wm.impl.welcomeScreen.cloneableProjects.VcsCloneCollector;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import git4idea.GitUtil;
|
||||
import git4idea.GitVcs;
|
||||
@@ -37,6 +39,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static git4idea.GitNotificationIdsHolder.CLONE_FAILED;
|
||||
@@ -109,7 +112,14 @@ public final class GitCheckoutProvider extends CheckoutProviderEx {
|
||||
DvcsBundle.message("clone.repository.failed"),
|
||||
DvcsBundle.message("clone.repository.canceled"),
|
||||
DvcsBundle.message("clone.stop.message.title"),
|
||||
DvcsBundle.message("clone.stop.message.description", sourceRepositoryURL));
|
||||
DvcsBundle.message("clone.stop.message.description", sourceRepositoryURL)) {
|
||||
@Override
|
||||
public @NotNull List<@NotNull EventPair<?>> getActivityData() {
|
||||
if (shallowCloneOptions == null || shallowCloneOptions.getDepth() == null) return Collections.emptyList();
|
||||
int depth = shallowCloneOptions.getDepth();
|
||||
return List.of(VcsCloneCollector.SHALLOW_CLONE_DEPTH.with(depth));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user