Completions stats physical part, collector part left
#KT-33090 Comment
This commit is contained in:
committed by
Anton Yalyshev
parent
edd2cedfd3
commit
ac7c89b3b5
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea.statistics
|
||||
|
||||
object CompletionFUSCollector {
|
||||
private const val FileTypeAttribute = "file_type"
|
||||
private const val WindowPopulationTimeAttribute = "window_population_time"
|
||||
private const val CompletionEventAttribute = "completion_event"
|
||||
private const val ChoiceAtPositionAttribute = "choice_at_position"
|
||||
private const val CompletionTypeAttribute = "completion_type"
|
||||
|
||||
private const val Chosen = "chosen"
|
||||
private const val NotChosen = "not_chosen"
|
||||
|
||||
private const val EventName = "Completion"
|
||||
|
||||
@Volatile
|
||||
var completionStatsData: CompletionStatsData? = null
|
||||
|
||||
data class CompletionStatsData(
|
||||
val startTime: Long,
|
||||
val shownTime: Long? = null,
|
||||
val finishTime: Long? = null,
|
||||
val completionType: CompletionTypeStats? = null,
|
||||
val fileType: FileTypeStats? = null,
|
||||
val finishReason: FinishReasonStats? = null,
|
||||
val selectedItem: Int? = null,
|
||||
val invocationCount: Int? = null
|
||||
)
|
||||
|
||||
fun log(completionStatsData: CompletionStatsData?) {
|
||||
/*if (completionStatsData == null) return
|
||||
val data = mutableMapOf<String, String>()
|
||||
.plus(Pair(WindowPopulationTimeAttribute, time))
|
||||
.plus(Pair(FileTypeAttribute, fileType.toString()))
|
||||
.plus(Pair(CompletionTypeAttribute, completionType.toString()))
|
||||
|
||||
if (choicePosition != null) {
|
||||
data.plus(Pair(ChoiceAtPositionAttribute, choicePosition))
|
||||
.plus(Pair(CompletionEventAttribute, Chosen))
|
||||
KotlinFUSLogger.log(FUSEventGroups.Editor, EventName, data)
|
||||
} else {
|
||||
data.plus(Pair(CompletionEventAttribute, NotChosen))
|
||||
KotlinFUSLogger.log(FUSEventGroups.Editor, EventName, data)
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
enum class FileTypeStats {
|
||||
KT, GRADLEKTS, KTS
|
||||
}
|
||||
|
||||
enum class CompletionTypeStats {
|
||||
BASIC, SMART
|
||||
}
|
||||
|
||||
enum class FinishReasonStats {
|
||||
DONE, CANCELLED, HIDDEN, INTERRUPTED
|
||||
}
|
||||
Reference in New Issue
Block a user