[debugger] IDEA-349254 Add platform part statistics

- visualizer shown
- visualizer closed (with some causes)

GitOrigin-RevId: 8dc3b3172c20a191f065d293d0f2e6cb76dbbcef
This commit is contained in:
Alexander Kuznetsov
2024-10-14 23:57:32 +00:00
committed by intellij-monorepo-bot
parent 8ffca92054
commit ceb1835d62
3 changed files with 36 additions and 2 deletions
@@ -52,6 +52,7 @@ class CollectionVisualizerEvaluator(private val visualizer: CollectionVisualizer
disposeOnResume(evaluationContext, scope)
closeOnEsc()
show()
CollectionVisualizerStatisticsCollector.reportShown(project)
}
}
}
@@ -64,14 +65,21 @@ class CollectionVisualizerEvaluator(private val visualizer: CollectionVisualizer
evaluationContext.debugProcess.addDebugProcessListener(object : DebugProcessListener {
override fun resumed(suspendContext: SuspendContext?) {
if (affectedByResume(suspendContext)) {
close()
scope.cancel()
CollectionVisualizerStatisticsCollector.reportClosed(evaluationContext.project, VisualizerClosedCause.RESUME)
doClose()
}
}
override fun processDetached(process: DebugProcess, closedByUser: Boolean) {
val cause = if (closedByUser) VisualizerClosedCause.DETACH_MANUAL else VisualizerClosedCause.DETACH_AUTO
CollectionVisualizerStatisticsCollector.reportClosed(evaluationContext.project, cause)
doClose()
}
private fun doClose() {
close()
scope.cancel()
evaluationContext.debugProcess.removeDebugProcessListener(this)
}
// maximum conservatism -- better close more popups than make them leak
@@ -0,0 +1,25 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.debugger.collections.visualizer
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.project.Project
internal object CollectionVisualizerStatisticsCollector : CounterUsagesCollector() {
private val GROUP = EventLogGroup("debugger.collection.visualizer", 1)
private val closedEvent = GROUP.registerEvent("closed", EventFields.Enum("cause", VisualizerClosedCause::class.java))
private val shownEvent = GROUP.registerEvent("shown")
fun reportShown(project: Project) = shownEvent.log(project)
fun reportClosed(project: Project, cause: VisualizerClosedCause) = closedEvent.log(project, cause)
override fun getGroup(): EventLogGroup = GROUP
}
enum class VisualizerClosedCause {
RESUME,
DETACH_AUTO,
DETACH_MANUAL,
}
@@ -575,6 +575,7 @@
<statistics.counterUsagesCollector implementationClass="com.intellij.compiler.impl.BuildUsageCollector"/>
<statistics.counterUsagesCollector implementationClass="com.intellij.debugger.statistics.DebuggerStatistics"/>
<statistics.counterUsagesCollector implementationClass="com.intellij.debugger.engine.evaluation.statistics.JavaDebuggerEvaluatorStatisticsCollector"/>
<statistics.counterUsagesCollector implementationClass="com.intellij.debugger.collections.visualizer.CollectionVisualizerStatisticsCollector"/>
<feedback.idleFeedbackSurvey implementation="com.intellij.debugger.feedback.KotlinDebuggerFeedbackSurvey"/>