mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
[ML-2618] ML API: Use the ML recorder for logging events
Update the group version Add ML event recorder Merge-request: IJ-MR-127859 Merged-by: Gleb Marin <Gleb.Marin@jetbrains.com> GitOrigin-RevId: 6ea502c751a7b47bbe3860caa6209be1f6ef45b4
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b9c46aff5f
commit
c5434fd3df
@@ -6,6 +6,8 @@
|
||||
|
||||
<projectService serviceInterface="com.intellij.internal.statistic.local.LanguageUsageStatisticsProvider"
|
||||
serviceImplementation="com.intellij.internal.statistic.local.LanguageUsageStatisticsProviderImpl"/>
|
||||
|
||||
<statistic.eventLog.eventLoggerProvider implementation="com.intellij.platform.ml.impl.logs.MLEventLoggerProvider"/>
|
||||
</extensions>
|
||||
|
||||
<projectListeners>
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.platform.ml.impl.logs
|
||||
|
||||
import com.intellij.internal.statistic.eventLog.StatisticsEventLoggerProvider
|
||||
import com.intellij.internal.statistic.utils.StatisticsUploadAssistant
|
||||
import com.intellij.openapi.application.ApplicationInfo
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.util.PlatformUtils
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
/**
|
||||
* Creates collector of ML logs
|
||||
*
|
||||
* Is also handled here: [com.intellij.internal.statistic.eventLog.StatisticsEventLogProvidersHolder.isProviderApplicable]
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
class MLEventLoggerProvider : StatisticsEventLoggerProvider(
|
||||
ML_RECORDER_ID,
|
||||
1,
|
||||
sendFrequencyMs = TimeUnit.MINUTES.toMillis(10),
|
||||
maxFileSizeInBytes = 100 * 1024,
|
||||
sendLogsOnIdeClose = true,
|
||||
isCharsEscapingRequired = true
|
||||
) {
|
||||
override fun isRecordEnabled(): Boolean {
|
||||
val app = ApplicationManager.getApplication()
|
||||
return !app.isUnitTestMode && app.isEAP &&
|
||||
StatisticsUploadAssistant.isCollectAllowed() &&
|
||||
(ApplicationInfo.getInstance() == null || PlatformUtils.isJetBrainsProduct())
|
||||
}
|
||||
|
||||
override fun isSendEnabled(): Boolean {
|
||||
return isRecordEnabled() && StatisticsUploadAssistant.isSendAllowed()
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val ML_RECORDER_ID = "ML"
|
||||
}
|
||||
}
|
||||
@@ -57,7 +57,7 @@ internal class StatisticsEventLogProvidersHolder {
|
||||
}
|
||||
val pluginInfo = getPluginInfo(extension::class.java)
|
||||
|
||||
return if (recorderId == "MLSE") {
|
||||
return if (recorderId == "MLSE" || recorderId == "ML") {
|
||||
pluginInfo.isDevelopedByJetBrains()
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user