Skip to content

Commit 119d32f

Browse files
committed
metrics
1 parent ad03841 commit 119d32f

File tree

1 file changed

+16
-0
lines changed
  • plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/controller/chat/telemetry

1 file changed

+16
-0
lines changed

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/controller/chat/telemetry/TelemetryHelper.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package software.aws.toolkits.jetbrains.services.cwc.controller.chat.telemetry
55

66
import com.intellij.openapi.project.Project
7+
import com.intellij.openapi.project.ProjectManager
78
import org.jetbrains.annotations.VisibleForTesting
89
import software.amazon.awssdk.services.codewhispererruntime.model.ChatInteractWithMessageEvent
910
import software.amazon.awssdk.services.codewhispererruntime.model.ChatMessageInteractionType
@@ -14,6 +15,9 @@ import software.aws.toolkits.core.utils.debug
1415
import software.aws.toolkits.core.utils.getLogger
1516
import software.aws.toolkits.core.utils.info
1617
import software.aws.toolkits.core.utils.warn
18+
import software.aws.toolkits.jetbrains.core.credentials.ToolkitConnection
19+
import software.aws.toolkits.jetbrains.core.credentials.ToolkitConnectionManager
20+
import software.aws.toolkits.jetbrains.core.credentials.pinning.QConnection
1721
import software.aws.toolkits.jetbrains.services.codewhisperer.credentials.CodeWhispererClientAdaptor
1822
import software.aws.toolkits.jetbrains.services.codewhisperer.customization.CodeWhispererCustomization
1923
import software.aws.toolkits.jetbrains.services.codewhisperer.customization.CodeWhispererModelConfigurator
@@ -29,6 +33,7 @@ import software.aws.toolkits.jetbrains.services.telemetry.TelemetryService
2933
import software.aws.toolkits.jetbrains.settings.CodeWhispererSettings
3034
import software.aws.toolkits.jetbrains.utils.notifyError
3135
import software.aws.toolkits.resources.message
36+
import software.aws.toolkits.telemetry.AuthTelemetry
3237
import software.aws.toolkits.telemetry.CwsprChatCommandType
3338
import software.aws.toolkits.telemetry.CwsprChatConversationType
3439
import software.aws.toolkits.telemetry.CwsprChatInteractionType
@@ -410,12 +415,23 @@ class TelemetryHelper(private val project: Project, private val sessionStorage:
410415
companion object {
411416
private val logger = getLogger<TelemetryHelper>()
412417

418+
419+
fun getQConnection(): ToolkitConnection? = ToolkitConnectionManager.getInstance(
420+
ProjectManager.getInstance().openProjects.first()
421+
).activeConnectionForFeature(QConnection.getInstance())
422+
413423
fun recordOpenChat() {
414424
Telemetry.amazonq.openChat.use { it.passive(true) }
425+
if (getQConnection() == null) {
426+
AuthTelemetry.signInPageOpened()
427+
}
415428
}
416429

417430
fun recordCloseChat() {
418431
Telemetry.amazonq.closeChat.use { it.passive(true) }
432+
if (getQConnection() == null) {
433+
AuthTelemetry.signInPageClosed()
434+
}
419435
}
420436

421437
fun recordTelemetryChatRunCommand(type: CwsprChatCommandType, name: String? = null, startUrl: String? = null) {

0 commit comments

Comments
 (0)