From 08e68ebded2b653b6dd3ef24fcff9ee1e9f90bbc Mon Sep 17 00:00:00 2001 From: Anastasia Ivanova Date: Tue, 11 Jan 2022 16:23:13 +0700 Subject: [PATCH] FUS: migrate "vfs" to the new API (IDEA-268269) GitOrigin-RevId: 2bfb46f3212506e61d37a50a0cdf89a13f7b6d6b --- .../src/META-INF/PlatformExtensions.xml | 2 +- .../openapi/vfs/newvfs/RefreshProgress.java | 9 ++----- .../openapi/vfs/newvfs/VfsUsageCollector.kt | 25 +++++++++++++++++++ 3 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 platform/vfs-impl/src/com/intellij/openapi/vfs/newvfs/VfsUsageCollector.kt diff --git a/platform/platform-resources/src/META-INF/PlatformExtensions.xml b/platform/platform-resources/src/META-INF/PlatformExtensions.xml index bcd4f919c1e6..c17b5b6606c9 100644 --- a/platform/platform-resources/src/META-INF/PlatformExtensions.xml +++ b/platform/platform-resources/src/META-INF/PlatformExtensions.xml @@ -759,7 +759,7 @@ . - + diff --git a/platform/vfs-impl/src/com/intellij/openapi/vfs/newvfs/RefreshProgress.java b/platform/vfs-impl/src/com/intellij/openapi/vfs/newvfs/RefreshProgress.java index d85a433d90f8..c59d1ccfc718 100644 --- a/platform/vfs-impl/src/com/intellij/openapi/vfs/newvfs/RefreshProgress.java +++ b/platform/vfs-impl/src/com/intellij/openapi/vfs/newvfs/RefreshProgress.java @@ -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); }); } } diff --git a/platform/vfs-impl/src/com/intellij/openapi/vfs/newvfs/VfsUsageCollector.kt b/platform/vfs-impl/src/com/intellij/openapi/vfs/newvfs/VfsUsageCollector.kt new file mode 100644 index 000000000000..f4799fef4209 --- /dev/null +++ b/platform/vfs-impl/src/com/intellij/openapi/vfs/newvfs/VfsUsageCollector.kt @@ -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) + } + } +} \ No newline at end of file