index: drop always-true options
[idea/community.git] / plugins / maven / src / main / java / org / jetbrains / idea / maven / statistics / MavenImportCollector.kt
1 // Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
2 package org.jetbrains.idea.maven.statistics
3
4 import com.intellij.internal.statistic.eventLog.EventLogGroup
5 import com.intellij.internal.statistic.eventLog.events.EventFields
6 import com.intellij.internal.statistic.service.fus.collectors.CounterUsagesCollector
7 import org.jetbrains.annotations.ApiStatus
8
9 @ApiStatus.Internal
10 class MavenImportCollector : CounterUsagesCollector() {
11   companion object {
12     val GROUP = EventLogGroup("maven.import", 8)
13
14     @JvmField
15     val HAS_USER_ADDED_LIBRARY_DEP = GROUP.registerEvent("hasUserAddedLibraryDependency")
16
17     @JvmField
18     val HAS_USER_ADDED_MODULE_DEP = GROUP.registerEvent("hasUserAddedModuleDependency")
19
20     @JvmField
21     val HAS_USER_MODIFIED_IMPORTED_LIBRARY = GROUP.registerEvent("hasUserModifiedImportedLibrary")
22
23     @JvmField
24     val NUMBER_OF_MODULES = EventFields.RoundedInt("number_of_modules")
25
26     // >>> Legacy import phases
27     @JvmField
28     val LEGACY_IMPORT = GROUP.registerIdeActivity("legacy_import",
29                                                   finishEventAdditionalFields = arrayOf(NUMBER_OF_MODULES))
30
31     @JvmField
32     val LEGACY_CREATE_MODULES_PHASE = GROUP.registerIdeActivity("create_modules", parentActivity = LEGACY_IMPORT)
33
34     @JvmField
35     val LEGACY_DELETE_OBSOLETE_PHASE = GROUP.registerIdeActivity("delete_obsolete", parentActivity = LEGACY_IMPORT)
36
37     @JvmField
38     val LEGACY_IMPORTERS_PHASE = GROUP.registerIdeActivity("importers", parentActivity = LEGACY_IMPORT)
39     // <<< Legacy import phases
40
41     @JvmField
42     val ACTIVITY_ID = EventFields.IdeActivityIdField
43
44     // >>> Workspace import phases
45     @JvmField
46     val WORKSPACE_IMPORT = GROUP.registerIdeActivity("workspace_import",
47                                                      finishEventAdditionalFields = arrayOf(NUMBER_OF_MODULES))
48
49     @JvmField
50     val WORKSPACE_FOLDERS_UPDATE = GROUP.registerIdeActivity("workspace_folders_update",
51                                                              finishEventAdditionalFields = arrayOf(NUMBER_OF_MODULES))
52
53     @JvmField
54     val WORKSPACE_POPULATE_PHASE = GROUP.registerIdeActivity("populate", parentActivity = WORKSPACE_IMPORT)
55
56     @JvmField
57     val DURATION_BACKGROUND_MS = EventFields.Long("duration_in_background_ms")
58
59     @JvmField
60     val DURATION_WRITE_ACTION_MS = EventFields.Long("duration_in_write_action_ms")
61
62     @JvmField
63     val DURATION_OF_WORKSPACE_UPDATE_CALL_MS = EventFields.Long("duration_of_workspace_update_call_ms")
64
65     @JvmField
66     val ATTEMPTS = EventFields.Int("attempts")
67
68     @JvmField
69     val WORKSPACE_COMMIT_STATS = GROUP.registerVarargEvent("workspace_commit", ACTIVITY_ID, DURATION_BACKGROUND_MS,
70                                                            DURATION_WRITE_ACTION_MS, DURATION_OF_WORKSPACE_UPDATE_CALL_MS, ATTEMPTS)
71
72     @JvmField
73     val WORKSPACE_COMMIT_PHASE = GROUP.registerIdeActivity("commit", parentActivity = WORKSPACE_IMPORT)
74
75     @JvmField
76     val WORKSPACE_LEGACY_IMPORTERS_PHASE = GROUP.registerIdeActivity("legacy_importers", parentActivity = WORKSPACE_IMPORT)
77     // <<< Workspace import phases
78
79     @JvmField
80     val TOTAL_DURATION_MS = EventFields.Long("total_duration_ms")
81
82     @JvmField
83     val COLLECT_FOLDERS_DURATION_MS = EventFields.Long("collect_folders_duration_ms")
84
85     @JvmField
86     val CONFIG_MODULES_DURATION_MS = EventFields.Long("config_modules_duration_ms")
87
88     @JvmField
89     val BEFORE_APPLY_DURATION_MS = EventFields.Long("before_apply_duration_ms")
90
91     @JvmField
92     val AFTER_APPLY_DURATION_MS = EventFields.Long("after_apply_duration_ms")
93
94     @JvmField
95     val IMPORTER_CLASS = EventFields.Class("importer_class")
96
97     @JvmField
98     val IMPORTER_RUN = GROUP.registerVarargEvent("importer_run", ACTIVITY_ID, IMPORTER_CLASS, NUMBER_OF_MODULES, TOTAL_DURATION_MS)
99
100     @JvmField
101     val CONFIGURATOR_CLASS = EventFields.Class("configurator_class")
102
103     @JvmField
104     val CONFIGURATOR_RUN = GROUP.registerVarargEvent("workspace_import.configurator_run",
105                                                      ACTIVITY_ID,
106                                                      CONFIGURATOR_CLASS,
107                                                      NUMBER_OF_MODULES,
108                                                      TOTAL_DURATION_MS,
109                                                      COLLECT_FOLDERS_DURATION_MS,
110                                                      CONFIG_MODULES_DURATION_MS,
111                                                      BEFORE_APPLY_DURATION_MS,
112                                                      AFTER_APPLY_DURATION_MS)
113   }
114
115   override fun getGroup(): EventLogGroup {
116     return GROUP
117   }
118 }