added lists of possible values for buildSystemTarget collectors

This commit is contained in:
Anton Yalyshev
2019-06-17 13:06:20 +03:00
parent edce35a643
commit eb5ab1cc52
5 changed files with 71 additions and 19 deletions
@@ -5,16 +5,63 @@
package org.jetbrains.kotlin.idea.statistics
// Note: along with adding a group to this enum you should also add its GROUP_ID to plugin.xml and get it whitelisted
// (see https://confluence.jetbrains.com/display/FUS/IntelliJ+Reporting+API).
enum class FUSEventGroups(groupIdSuffix: String) {
GradleTarget("gradle.target"),
MavenTarget("maven.target"),
JPSTarget("jps.target"),
/* Note: along with adding a group to this enum you should also add its GROUP_ID to plugin.xml and get it whitelisted
* (see https://confluence.jetbrains.com/display/FUS/IntelliJ+Reporting+API).
*
* Default value for [events] parameter is intended for collectors which don't have yet a set of allowed values for FUS Whitelist
*/
enum class FUSEventGroups(groupIdSuffix: String, val events: Set<String> = hashSetOf()) {
GradleTarget("gradle.target", gradleTargetEvents),
MavenTarget("maven.target", mavenTargetEvents),
JPSTarget("jps.target", JPSTargetEvents),
Refactoring("ide.action.refactoring"),
NewFileTemplate("ide.newFileTempl"),
NPWizards("ide.npwizards"),
DebugEval("ide.debugger.eval");
val GROUP_ID: String = "kotlin.$groupIdSuffix"
}
}
val gradleTargetEvents = hashSetOf(
"kotlin-android",
"kotlin-platform-common",
"kotlin-platform-js",
"kotlin-platform-jvm",
"MPP.androidJvm",
"MPP.androidJvm.android",
"MPP.common",
"MPP.common.metadata",
"MPP.js",
"MPP.js.js",
"MPP.jvm",
"MPP.jvm.jvm",
"MPP.jvm.jvmWithJava",
"MPP.native",
"MPP.native.androidNativeArm32",
"MPP.native.androidNativeArm64",
"MPP.native.iosArm32",
"MPP.native.iosArm64",
"MPP.native.iosX64",
"MPP.native.linuxArm32Hfp",
"MPP.native.linuxArm64",
"MPP.native.linuxMips32",
"MPP.native.linuxMipsel32",
"MPP.native.linuxX64",
"MPP.native.macosX64",
"MPP.native.mingwX64",
"MPP.native.mingwX86",
"MPP.native.wasm32",
"MPP.native.zephyrStm32f4Disco"
)
val mavenTargetEvents = hashSetOf(
"common",
"js",
"jvm"
)
val JPSTargetEvents = hashSetOf(
"common",
"js",
"jvm",
"native"
)
@@ -14,9 +14,15 @@ open class KotlinFUSLogger {
companion object {
private val context = FeatureUsageData().addData("plugin_version", KotlinPluginUtil.getPluginVersion())
private val logger = FUCounterUsageLogger.getInstance()
fun log(group: FUSEventGroups, event: String) {
FUCounterUsageLogger.getInstance().logEvent(group.GROUP_ID, event, context)
if (group.events.contains(event)) {
logger.logEvent(group.GROUP_ID, event, context)
} else {
logger.logEvent(group.GROUP_ID, "unknown", context)
}
}
fun log(group: FUSEventGroups, event: String, eventData: Map<String, String>) {
@@ -24,7 +30,7 @@ open class KotlinFUSLogger {
for (entry in eventData) {
localContext.addData(entry.key, entry.value)
}
FUCounterUsageLogger.getInstance().logEvent(group.GROUP_ID, event, localContext)
logger.logEvent(group.GROUP_ID, event, localContext)
}
}
}
@@ -223,10 +223,9 @@ class KotlinGradleProjectResolverExtension : AbstractProjectResolverExtension()
ideModule.coroutines = gradleModel.coroutines
ideModule.platformPluginId = gradleModel.platformPluginId
KotlinFUSLogger.log(
FUSEventGroups.GradleTarget,
gradleModel.kotlinTarget ?: "unknown"
)
if (gradleModel.hasKotlinPlugin) {
KotlinFUSLogger.log(FUSEventGroups.GradleTarget, gradleModel.kotlinTarget ?: "unknown")
}
addImplementedModuleNames(gradleModule, ideModule, ideProject, gradleModel)
+3 -3
View File
@@ -73,9 +73,9 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio.
</extensions>
<extensions defaultExtensionNs="com.intellij">
<statistics.counterUsagesCollector groupId="kotlin.gradle.target" version="1"/>
<statistics.counterUsagesCollector groupId="kotlin.maven.target" version="1"/>
<statistics.counterUsagesCollector groupId="kotlin.jps.target" version="1"/>
<statistics.counterUsagesCollector groupId="kotlin.gradle.target" version="2"/>
<statistics.counterUsagesCollector groupId="kotlin.maven.target" version="2"/>
<statistics.counterUsagesCollector groupId="kotlin.jps.target" version="2"/>
<statistics.counterUsagesCollector groupId="kotlin.gradle.library" version="1"/>
<statistics.counterUsagesCollector groupId="kotlin.ide.action.refactoring" version="1"/>
<statistics.counterUsagesCollector groupId="kotlin.ide.newFileTempl" version="1"/>
+3 -3
View File
@@ -73,9 +73,9 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio.
</extensions>
<extensions defaultExtensionNs="com.intellij">
<statistics.counterUsagesCollector groupId="kotlin.gradle.target" version="1"/>
<statistics.counterUsagesCollector groupId="kotlin.maven.target" version="1"/>
<statistics.counterUsagesCollector groupId="kotlin.jps.target" version="1"/>
<statistics.counterUsagesCollector groupId="kotlin.gradle.target" version="2"/>
<statistics.counterUsagesCollector groupId="kotlin.maven.target" version="2"/>
<statistics.counterUsagesCollector groupId="kotlin.jps.target" version="2"/>
<statistics.counterUsagesCollector groupId="kotlin.gradle.library" version="1"/>
<statistics.counterUsagesCollector groupId="kotlin.ide.action.refactoring" version="1"/>
<statistics.counterUsagesCollector groupId="kotlin.ide.newFileTempl" version="1"/>