PY-87526 Remove the collector for python.job.statistics

GitOrigin-RevId: b1d48b9c9cf392d7e2ee87d02661ac7d60eb3389
This commit is contained in:
Andrey Vokin
2026-02-12 16:22:26 +00:00
committed by intellij-monorepo-bot
parent 2ef1ccbf7a
commit a7461e16d1
12 changed files with 0 additions and 301 deletions
-2
View File
@@ -286,8 +286,6 @@ jvm_library(
"//platform/ui.jcef",
"//libraries/io",
"//platform/util/progress",
"//platform/feedback",
"//libraries/kotlinx/datetime",
"//platform/platform-impl/remote",
"//platform/platform-impl/ui",
"//libraries/jackson/module-kotlin:libraries-jackson-module-kotlin",
@@ -165,8 +165,6 @@
<orderEntry type="module" module-name="intellij.platform.ui.jcef" />
<orderEntry type="module" module-name="intellij.libraries.kotlinx.io" />
<orderEntry type="module" module-name="intellij.platform.util.progress" />
<orderEntry type="module" module-name="intellij.platform.feedback" />
<orderEntry type="module" module-name="intellij.libraries.kotlinx.datetime" />
<orderEntry type="module" module-name="intellij.platform.ide.remote" />
<orderEntry type="module" module-name="intellij.platform.ide.ui" />
<orderEntry type="module" module-name="intellij.libraries.jackson.module.kotlin" />
@@ -704,10 +704,6 @@
<registryKey key="python.detect.cross.module.dependencies" defaultValue="false"
description="Try to detect and automatically set-up module dependencies in a multi-module project"/>
<feedback.idleFeedbackSurvey implementation="com.jetbrains.python.statistics.feedback.PythonJobSurvey"/>
<statistics.counterUsagesCollector implementationClass="com.jetbrains.python.statistics.feedback.PythonJobStatisticsCollector"/>
<backgroundPostStartupActivity implementation="com.jetbrains.python.statistics.feedback.PythonFirstLaunchChecker"/>
<registryKey key="python.prebuilt.skeletons.minor.version.aware" defaultValue="false"
description="When disabled stripes minor version to look for prebuilt skeletons"/>
<registryKey key="python.activate.virtualenv.on.run" defaultValue="true"
@@ -1119,9 +1115,6 @@
text="Update Python SDK" description="Forcibly update all configured Python SDKs in the project"/>
<action id="PySetPropertyAction" internal="true" class="com.jetbrains.python.sdk.add.v2.PySetPropertyAction"
text="Set PropertiesComponent Value" description="Set value in application-level PropertiesComponent"/>
<action id="PyShowJobSurvey" internal="true" class="com.jetbrains.python.statistics.feedback.PythonShowJobSurveyAction"
text="Show Python Job Survey"/>
<add-to-group group-id="Internal"/>
</group>
<group id="Python.NewInterpreter.Extra" popup="false"/>
@@ -1657,18 +1657,6 @@ action.PipUpdateEnvAction.FloatingToolbar.text=Install All
action.PipEnvLockDependenciesAction.text=Generate a Pipfile.lock
action.PipEnvInstallDependenciesAction.text=Install Dependencies
python.survey.user.job.notification.group=PyCharm Job Survey
python.survey.user.job.notification.title=Feedback In IDE
python.survey.user.job.notification.content=Tell us about your Python development experience. Just one question.
python.survey.user.job.dialog.title=Feedback
python.survey.user.job.dialog.blocks.top=Python development
python.survey.user.job.dialog.blocks.checkbox.group=What do you use Python for?
python.survey.user.job.dialog.blocks.checkbox.data=Data analysis
python.survey.user.job.dialog.blocks.checkbox.ml=Machine learning
python.survey.user.job.dialog.blocks.checkbox.web=Web development
python.survey.user.job.dialog.blocks.checkbox.scripts=Writing automation scripts / parsers / tests / system administration
python.survey.user.job.dialog.blocks.checkbox.other=Other
validation.invalid.name=Invalid name
dialog.message.command.could.not.complete=Command could not be completed successfully. \
Please see the command's output for information about resolving this problem.
@@ -1,35 +0,0 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.jetbrains.python.statistics.feedback
import com.intellij.openapi.components.BaseState
import com.intellij.openapi.project.Project
import com.intellij.openapi.startup.ProjectActivity
import kotlinx.datetime.Clock
import kotlinx.datetime.LocalDateTime
import kotlinx.datetime.TimeZone
import kotlinx.datetime.toJavaLocalDateTime
import kotlinx.datetime.toLocalDateTime
import java.time.Duration
class PythonJobSurveyState : BaseState() {
var firstLaunch by string()
}
class PythonFirstLaunchChecker : ProjectActivity {
override suspend fun execute(project: Project) {
val state = PythonJobSurveyService.getInstance().state ?: return
if (state.firstLaunch == null) {
val dateTime = Clock.System.now().toLocalDateTime(TimeZone.currentSystemDefault())
state.firstLaunch = LocalDateTime.Formats.ISO.format(dateTime)
}
}
}
fun shouldShowSurvey(): Boolean {
val firstLaunch = PythonJobSurveyService.getInstance().state?.firstLaunch ?: return false
val dateTime = LocalDateTime.Formats.ISO.parse(firstLaunch)
// Start checking on the third day of usage
return Duration.between(dateTime.toJavaLocalDateTime(), java.time.LocalDateTime.now()).toDays() >= 3
}
@@ -1,76 +0,0 @@
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.jetbrains.python.statistics.feedback
import com.intellij.openapi.application.ApplicationInfo
import com.intellij.openapi.components.BaseState
import com.intellij.openapi.components.Service
import com.intellij.openapi.components.SimplePersistentStateComponent
import com.intellij.openapi.components.State
import com.intellij.openapi.components.Storage
import com.intellij.openapi.components.service
import com.intellij.openapi.project.Project
import com.intellij.platform.feedback.ExternalFeedbackSurveyConfig
import com.intellij.platform.feedback.ExternalFeedbackSurveyType
import com.intellij.platform.feedback.FeedbackSurvey
import com.intellij.platform.feedback.impl.notification.RequestFeedbackNotification
import com.intellij.platform.ide.impl.customization.currentOsNameForIntelliJSupport
import com.intellij.util.PlatformUtils
import com.intellij.util.Urls
import com.jetbrains.python.PyBundle
import kotlinx.datetime.LocalDate
internal class PyCharmUxSurvey : FeedbackSurvey() {
override val feedbackSurveyType: ExternalFeedbackSurveyType<*> =
ExternalFeedbackSurveyType(PyCharmUxSurveyConfig())
}
private class PyCharmUxSurveyConfig : ExternalFeedbackSurveyConfig {
override val surveyId: String = "pycharm_ux_survey_2026"
override val lastDayOfFeedbackCollection: LocalDate = LocalDate(
year = 2026,
monthNumber = 3,
dayOfMonth = 31,
)
override val requireIdeEAP: Boolean = false
override fun getUrlToSurvey(project: Project): String =
Urls.newFromEncoded("https://surveys.jetbrains.com/s3/pycharm-ux-survey")
.addParameters(
mapOf(
"build" to ApplicationInfo.getInstance().getBuild().asStringWithoutProductCode(),
"os" to currentOsNameForIntelliJSupport(),
)
)
.toExternalForm()
override fun createNotification(project: Project, forTest: Boolean): RequestFeedbackNotification =
RequestFeedbackNotification(
"Feedback in IDE",
PyBundle.message("pycharm.statistics.feedback.ux.survey.title"),
PyBundle.message("pycharm.statistics.feedback.ux.survey.content")
)
override fun updateStateAfterNotificationShowed(project: Project) {
service<PyCharmUxSurveyStore>().state.wasShown = true
}
override fun checkIdeIsSuitable(): Boolean =
PlatformUtils.isPyCharm() && !PlatformUtils.isDataSpell()
override fun checkExtraConditionSatisfied(project: Project): Boolean =
!service<PyCharmUxSurveyStore>().state.wasShown
override fun updateStateAfterRespondActionInvoked(project: Project) {
// no op
}
}
@Service
@State(name = "PyCharmUxSurveyStore", storages = [Storage("pycharm-ux-survey.xml")])
private class PyCharmUxSurveyStore : SimplePersistentStateComponent<PyCharmUxSurveyStore.State>(State()) {
class State : BaseState() {
var wasShown by property(false)
}
}
@@ -1,24 +0,0 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.jetbrains.python.statistics.feedback
import com.intellij.internal.statistic.eventLog.EventLogGroup
import com.intellij.internal.statistic.eventLog.events.EventFields
import com.intellij.internal.statistic.eventLog.events.EventId2
import com.intellij.internal.statistic.service.fus.collectors.CounterUsagesCollector
object PythonJobStatisticsCollector : CounterUsagesCollector() {
private val GROUP = EventLogGroup("python.job.statistics", 2)
private val USE_FOR = EventFields.StringList("use_for", listOf("data_analysis", "ml", "web_dev", "scripts"))
private val OTHER = EventFields.StringValidatedByInlineRegexp("other", "[\\w\\s,.!?-]{1,25}")
private val JOB_EVENT: EventId2<List<String>, String?> = GROUP.registerEvent("job.survey.triggered", USE_FOR, OTHER)
@JvmStatic
fun logJobEvent(useFor: List<String>, other: String?) {
JOB_EVENT.log(useFor, other)
}
override fun getGroup(): EventLogGroup {
return GROUP
}
}
@@ -1,11 +0,0 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.jetbrains.python.statistics.feedback
import com.intellij.platform.feedback.FeedbackSurvey
import com.intellij.platform.feedback.InIdeFeedbackSurveyConfig
import com.intellij.platform.feedback.InIdeFeedbackSurveyType
class PythonJobSurvey : FeedbackSurvey() {
override val feedbackSurveyType: InIdeFeedbackSurveyType<InIdeFeedbackSurveyConfig> =
InIdeFeedbackSurveyType(PythonJobSurveyConfig())
}
@@ -1,42 +0,0 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.jetbrains.python.statistics.feedback
import com.intellij.openapi.project.Project
import com.intellij.platform.feedback.InIdeFeedbackSurveyConfig
import com.intellij.platform.feedback.dialog.BlockBasedFeedbackDialog
import com.intellij.platform.feedback.dialog.SystemDataJsonSerializable
import com.intellij.platform.feedback.impl.notification.RequestFeedbackNotification
import com.intellij.util.PlatformUtils
import com.jetbrains.python.PyBundle.message
import kotlinx.datetime.LocalDate
class PythonJobSurveyConfig : InIdeFeedbackSurveyConfig {
override fun createFeedbackDialog(project: Project, forTest: Boolean): BlockBasedFeedbackDialog<out SystemDataJsonSerializable> {
return PythonUserJobFeedbackDialog(project, forTest)
}
override val surveyId: String = "python_user_job_survey"
override val requireIdeEAP: Boolean = false
override val lastDayOfFeedbackCollection: LocalDate
get() = LocalDate(2025, 4, 30)
override fun checkIdeIsSuitable(): Boolean = PlatformUtils.isPyCharmPro()
override fun checkExtraConditionSatisfied(project: Project): Boolean = shouldShowSurvey()
override fun createNotification(project: Project, forTest: Boolean): RequestFeedbackNotification {
return RequestFeedbackNotification(
message("python.survey.user.job.notification.group"),
message("python.survey.user.job.notification.title"),
message("python.survey.user.job.notification.content"),
)
}
override fun updateStateAfterNotificationShowed(project: Project) {
}
override fun updateStateAfterDialogClosedOk(project: Project) {
}
}
@@ -1,25 +0,0 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.jetbrains.python.statistics.feedback
import com.intellij.openapi.components.PersistentStateComponent
import com.intellij.openapi.components.Service
import com.intellij.openapi.components.State
import com.intellij.openapi.components.Storage
import com.intellij.openapi.components.service
@Service(Service.Level.APP)
@State(name="PythonJobSurveyService", storages = [Storage("pycharm-job-survey-service.xml")])
class PythonJobSurveyService : PersistentStateComponent<PythonJobSurveyState> {
private var state = PythonJobSurveyState()
override fun getState(): PythonJobSurveyState? = state
override fun loadState(state: PythonJobSurveyState) {
this.state = state
}
companion object {
@JvmStatic
fun getInstance(): PythonJobSurveyService = service()
}
}
@@ -1,11 +0,0 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.jetbrains.python.statistics.feedback
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
class PythonShowJobSurveyAction : AnAction() {
override fun actionPerformed(e: AnActionEvent) {
PythonJobSurvey().showNotification(e.project!!, true)
}
}
@@ -1,54 +0,0 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.jetbrains.python.statistics.feedback
import com.intellij.openapi.project.Project
import com.intellij.platform.feedback.dialog.CommonBlockBasedFeedbackDialog
import com.intellij.platform.feedback.dialog.uiBlocks.CheckBoxGroupBlock
import com.intellij.platform.feedback.dialog.uiBlocks.CheckBoxItemData
import com.intellij.platform.feedback.dialog.uiBlocks.FeedbackBlock
import com.intellij.platform.feedback.dialog.uiBlocks.TopLabelBlock
import com.jetbrains.python.PyBundle.message
class PythonUserJobFeedbackDialog(
project: Project?,
forTest: Boolean,
) : CommonBlockBasedFeedbackDialog(project, forTest) {
override val myFeedbackReportId: String
get() = "python_user_job_survey"
override val myTitle: String
get() = message("python.survey.user.job.dialog.title")
val items = listOf(
CheckBoxItemData(message("python.survey.user.job.dialog.blocks.checkbox.data"), "data_analysis"),
CheckBoxItemData(message("python.survey.user.job.dialog.blocks.checkbox.ml"), "ml"),
CheckBoxItemData(message("python.survey.user.job.dialog.blocks.checkbox.web"), "web_dev"),
CheckBoxItemData(message("python.survey.user.job.dialog.blocks.checkbox.scripts"), "scripts"),
)
override val myBlocks: List<FeedbackBlock> = listOf(
TopLabelBlock(message("python.survey.user.job.dialog.blocks.top")),
CheckBoxGroupBlock(message("python.survey.user.job.dialog.blocks.checkbox.group"), items, "python_job_checkbox")
.addOtherTextField(message("python.survey.user.job.dialog.blocks.checkbox.other"))
.requireAnswer(),
)
override fun sendFeedbackData() {
super.sendFeedbackData()
val builder = StringBuilder()
(myBlocks[1] as CheckBoxGroupBlock).collectBlockTextDescription(builder)
val selectedItems = items.filter { it.property }.map { it.jsonElementName }
val other = builder.toString()
.lines()[5].substringAfter(message("python.survey.user.job.dialog.blocks.checkbox.other") + ": ").take(25)
PythonJobStatisticsCollector.logJobEvent(selectedItems, other)
}
init {
init()
}
}