@@ -88,8 +88,6 @@ class ActivityMonitor(private val project: Project, cs: CoroutineScope) : Dispos
8888 private var serverInfo: AboutResult ? = null
8989 private val simpleEventInterceptor = SimpleEventInterceptor (project)
9090
91- private val userId: String = UniqueGeneratedUserId .userId
92- private val isDevUser: Boolean = UniqueGeneratedUserId .isDevUser
9391 private var postHog: PostHog ? = null
9492 private val settingsChangeTracker = SettingsChangeTracker ()
9593
@@ -173,7 +171,7 @@ class ActivityMonitor(private val project: Project, cs: CoroutineScope) : Dispos
173171 mutableDetails[" server.deploymentType" ] = serverInfo?.deploymentType.toString()
174172
175173 postHog?.capture(
176- userId,
174+ UniqueGeneratedUserId . userId,
177175 eventName,
178176 mutableDetails
179177 )
@@ -183,7 +181,7 @@ class ActivityMonitor(private val project: Project, cs: CoroutineScope) : Dispos
183181 fun registerFramework (framework : MonitoredFramework ) {
184182 capture(" framework detected" , mapOf (" framework.name" to framework.name))
185183 postHog?.set(
186- userId, mapOf (
184+ UniqueGeneratedUserId . userId, mapOf (
187185 " framework.last" to framework.name,
188186 " framework.${framework.name} .last-seen" to Instant .now().toString()
189187 )
@@ -192,13 +190,13 @@ class ActivityMonitor(private val project: Project, cs: CoroutineScope) : Dispos
192190
193191 fun registerEmail (email : String , courseRequested : Boolean ) {
194192 postHog?.identify(
195- userId, mapOf (
193+ UniqueGeneratedUserId . userId, mapOf (
196194 " email" to getEmailForEvent(),
197195 INSTALL_STATUS_PROPERTY_NAME to getCurrentInstallStatus(),
198196 " user_requested_course" to courseRequested.toString()
199197 )
200198 )
201- postHog?.alias(userId, email)
199+ postHog?.alias(UniqueGeneratedUserId . userId, email)
202200 }
203201
204202 fun registerCustomEvent (eventName : String , tags : Map <String , Any > = mapOf()) {
@@ -243,7 +241,7 @@ class ActivityMonitor(private val project: Project, cs: CoroutineScope) : Dispos
243241 detailsToSend
244242 )
245243 postHog?.set(
246- userId, mapOf (
244+ UniqueGeneratedUserId . userId, mapOf (
247245 " last-user-action" to action,
248246 " last-user-action-timestamp" to lastUserActionTimestamp.toString()
249247 )
@@ -320,7 +318,7 @@ class ActivityMonitor(private val project: Project, cs: CoroutineScope) : Dispos
320318 fun registerFirstAssetsReceived () {
321319 capture(" plugin first-assets" )
322320 postHog?.set(
323- userId, mapOf (
321+ UniqueGeneratedUserId . userId, mapOf (
324322 " first-assets-timestamp" to Instant .now().toString()
325323 )
326324 )
@@ -365,7 +363,7 @@ class ActivityMonitor(private val project: Project, cs: CoroutineScope) : Dispos
365363 " ide.build" to ideBuildNumber,
366364 " plugin.version" to pluginVersion,
367365 " server.version" to serverInfo?.applicationVersion.toString(),
368- " user.type" to if (isDevUser) " internal" else " external"
366+ " user.type" to if (UniqueGeneratedUserId . isDevUser) " internal" else " external"
369367 )
370368
371369
@@ -470,7 +468,7 @@ class ActivityMonitor(private val project: Project, cs: CoroutineScope) : Dispos
470468 " ide.build" to ideBuildNumber,
471469 " plugin.version" to pluginVersion,
472470 " server.version" to serverInfo?.applicationVersion.toString(),
473- " user.type" to if (isDevUser) " internal" else " external" ,
471+ " user.type" to if (UniqueGeneratedUserId . isDevUser) " internal" else " external" ,
474472 " frequency" to frequency.frequencySinceStart,
475473 " frequency.since.minutes" to frequency.formatDurationToMinutes()
476474 )
@@ -649,15 +647,15 @@ class ActivityMonitor(private val project: Project, cs: CoroutineScope) : Dispos
649647
650648 // todo: remove at some point
651649 fun registerFirstTimePluginLoaded () {
652- postHog?.capture(userId, " plugin first-loaded" )
650+ postHog?.capture(UniqueGeneratedUserId . userId, " plugin first-loaded" )
653651 }
654652
655653 fun registerFirstTimePluginLoadedNew () {
656- postHog?.capture(userId, " plugin first-init" )
654+ postHog?.capture(UniqueGeneratedUserId . userId, " plugin first-init" )
657655 }
658656
659657 fun registerPluginLoaded () {
660- postHog?.capture(userId, " plugin loaded" )
658+ postHog?.capture(UniqueGeneratedUserId . userId, " plugin loaded" )
661659 }
662660
663661 fun registerPluginUninstalled (): String {
@@ -678,12 +676,12 @@ class ActivityMonitor(private val project: Project, cs: CoroutineScope) : Dispos
678676 )
679677 }
680678 postHog?.set(
681- userId, mapOf (
679+ UniqueGeneratedUserId . userId, mapOf (
682680 INSTALL_STATUS_PROPERTY_NAME to getCurrentInstallStatus(),
683681 INSTALL_STATUS_PROPERTY_NAME + " _timestamp" to SessionMetadataProperties .getInstance().getCreatedAsString(CURRENT_INSTALL_STATUS_KEY )
684682 )
685683 )
686- return userId
684+ return UniqueGeneratedUserId . userId
687685 }
688686
689687 fun registerPluginDisabled (): String {
@@ -704,12 +702,12 @@ class ActivityMonitor(private val project: Project, cs: CoroutineScope) : Dispos
704702 )
705703 }
706704 postHog?.set(
707- userId, mapOf (
705+ UniqueGeneratedUserId . userId, mapOf (
708706 INSTALL_STATUS_PROPERTY_NAME to getCurrentInstallStatus(),
709707 INSTALL_STATUS_PROPERTY_NAME + " _timestamp" to SessionMetadataProperties .getInstance().getCreatedAsString(CURRENT_INSTALL_STATUS_KEY )
710708 )
711709 )
712- return userId
710+ return UniqueGeneratedUserId . userId
713711 }
714712
715713
@@ -718,7 +716,7 @@ class ActivityMonitor(private val project: Project, cs: CoroutineScope) : Dispos
718716 if (this .serverInfo != serverInfo) {
719717 this .serverInfo = serverInfo
720718 postHog?.set(
721- userId,
719+ UniqueGeneratedUserId . userId,
722720 mapOf (
723721 " server.version" to serverInfo.applicationVersion,
724722 " server.deploymentType" to (serverInfo.deploymentType ? : BackendDeploymentType .Unknown ),
@@ -768,7 +766,7 @@ class ActivityMonitor(private val project: Project, cs: CoroutineScope) : Dispos
768766
769767 fun registerContainerEngine (containerPlatform : String ) {
770768 postHog?.set(
771- userId,
769+ UniqueGeneratedUserId . userId,
772770 mapOf (" user.container-engine" to containerPlatform)
773771 )
774772 }
@@ -841,14 +839,14 @@ class ActivityMonitor(private val project: Project, cs: CoroutineScope) : Dispos
841839 val isJcefSupported = JBCefApp .isSupported()
842840
843841 postHog?.set(
844- userId,
842+ UniqueGeneratedUserId . userId,
845843 mapOf (
846844 " os.type" to osType,
847845 " ide.name" to ideName,
848846 " ide.version" to ideVersion,
849847 " ide.build" to ideBuildNumber,
850848 " plugin.version" to pluginVersion,
851- " user.type" to if (isDevUser) " internal" else " external" ,
849+ " user.type" to if (UniqueGeneratedUserId . isDevUser) " internal" else " external" ,
852850 " jcef.supported" to isJcefSupported,
853851 INSTALL_STATUS_PROPERTY_NAME to getCurrentInstallStatus()
854852 )
@@ -887,7 +885,7 @@ class ActivityMonitor(private val project: Project, cs: CoroutineScope) : Dispos
887885 )
888886
889887 postHog?.identify(
890- userId,
888+ UniqueGeneratedUserId . userId,
891889 mapOf (
892890 LOAD_WARNING_APPEARED_PROPERTY_NAME + " _timestamp" to PersistenceService .getInstance().getLoadWarningAppearedTimestamp(),
893891 " user_requested_course" to " false"
@@ -919,7 +917,7 @@ class ActivityMonitor(private val project: Project, cs: CoroutineScope) : Dispos
919917 registerUserAction(eventName, eventDetails)
920918
921919 postHog?.identify(
922- userId,
920+ UniqueGeneratedUserId . userId,
923921 mapOf (
924922 ENVIRONMENT_ADDED_PROPERTY_NAME + " _timestamp" to PersistenceService .getInstance().getEnvironmentAddedTimestamp(),
925923 " user_requested_course" to " false"
@@ -951,7 +949,7 @@ class ActivityMonitor(private val project: Project, cs: CoroutineScope) : Dispos
951949 )
952950
953951 postHog?.identify(
954- userId,
952+ UniqueGeneratedUserId . userId,
955953 mapOf (
956954 JIRA_FIELD_COPIED_PROPERTY_NAME + " _timestamp" to PersistenceService .getInstance().getJiraFieldCopiedTimestamp(),
957955 " user_requested_course" to " false"
0 commit comments