FUS: migrate "vfs" to the new API (IDEA-268269)

GitOrigin-RevId: 2bfb46f3212506e61d37a50a0cdf89a13f7b6d6b
This commit is contained in:
Anastasia Ivanova
2022-01-13 05:10:34 +00:00
committed by intellij-monorepo-bot
parent b83de569a5
commit 08e68ebded
3 changed files with 28 additions and 8 deletions
@@ -759,7 +759,7 @@
<statistics.counterUsagesCollector implementationClass="com.intellij.ide.actions.cache.CacheRecoveryUsageCollector"/>.
<statistics.counterUsagesCollector groupId="new.project.wizard" version="3"/>
<statistics.counterUsagesCollector groupId="vfs" version="2"/>
<statistics.counterUsagesCollector implementationClass="com.intellij.openapi.vfs.newvfs.VfsUsageCollector"/>
<statistics.counterUsagesCollector implementationClass="com.intellij.openapi.project.IndexingStatisticsCollector"/>
<statistics.counterUsagesCollector implementationClass="com.intellij.task.impl.ProjectTaskManagerStatisticsCollector"/>
<statistics.counterUsagesCollector implementationClass="com.intellij.openapi.externalSystem.statistics.ProjectImportCollector"/>
@@ -53,13 +53,8 @@ final class RefreshProgress extends ProgressIndicatorBase {
application.runReadAction(() -> {
// refresh might be finished during IDE shutdown, in this case, don't report events (requred subsystems are already disposed)
if (application.isDisposed()) return;
FUCounterUsageLogger.getInstance().logEvent("vfs",
"refreshed",
new FeatureUsageData()
.addData("start_time_ms", myStartedTime)
.addData("finish_time_ms", finishedTime)
.addData("duration_ms", duration));
VfsUsageCollector.logVfsRefreshed(myStartedTime, finishedTime, duration);
});
}
}
@@ -0,0 +1,25 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.vfs.newvfs
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 VfsUsageCollector: CounterUsagesCollector() {
override fun getGroup(): EventLogGroup {
return GROUP
}
companion object {
private val GROUP = EventLogGroup("vfs", 3)
private val REFRESHED = GROUP.registerEvent("refreshed",
EventFields.Long("start_time_ms"),
EventFields.Long("finish_time_ms"),
EventFields.DurationMs)
@JvmStatic
fun logVfsRefreshed(startedTime: Long, finishedTime: Long, duration: Long) {
REFRESHED.log(startedTime, finishedTime, duration)
}
}
}