Skip to content

Commit 0bab6b6

Browse files
authored
Adding perfClientLatency to telemetry event (#4)
1 parent a0c6fc1 commit 0bab6b6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/controller/CodeTestChatController.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,6 @@ class CodeTestChatController(
443443
var charDifference = 0
444444
var generatedFileContent = ""
445445
var selectedFileContent = ""
446-
var latencyOfTestGeneration = 0.0
447446

448447
when (message.actionID) {
449448
"utg_view_diff" -> {
@@ -487,7 +486,7 @@ class CodeTestChatController(
487486

488487
session.linesOfCodeGenerated = lineDifference.coerceAtLeast(0)
489488
session.charsOfCodeGenerated = charDifference.coerceAtLeast(0)
490-
latencyOfTestGeneration = (Instant.now().toEpochMilli() - session.startTimeOfTestGeneration)
489+
session.latencyOfTestGeneration = (Instant.now().toEpochMilli() - session.startTimeOfTestGeneration)
491490
UiTelemetry.click(null as Project?, "unitTestGeneration_viewDiff")
492491

493492
val buttonList = mutableListOf<Button>()
@@ -600,7 +599,7 @@ class CodeTestChatController(
600599
acceptedCharactersCount = session.charsOfCodeGenerated?.toLong(),
601600
generatedCharactersCount = session.charsOfCodeGenerated?.toLong(),
602601
result = MetricResult.Succeeded,
603-
perfClientLatency = latencyOfTestGeneration,
602+
perfClientLatency = session.latencyOfTestGeneration,
604603
isCodeBlockSelected = session.isCodeBlockSelected,
605604
artifactsUploadDuration = session.artifactUploadDuration,
606605
buildPayloadBytes = session.srcPayloadSize,
@@ -795,7 +794,7 @@ class CodeTestChatController(
795794
acceptedCharactersCount = 0,
796795
generatedCharactersCount = session.charsOfCodeGenerated?.toLong(),
797796
result = MetricResult.Succeeded,
798-
perfClientLatency = latencyOfTestGeneration,
797+
perfClientLatency = session.latencyOfTestGeneration,
799798
isCodeBlockSelected = session.isCodeBlockSelected,
800799
artifactsUploadDuration = session.artifactUploadDuration,
801800
buildPayloadBytes = session.srcPayloadSize,

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/session/Session.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ data class Session(val tabId: String) {
2828
var linesOfCodeGenerated: Int? = null
2929
var charsOfCodeGenerated: Int? = null
3030
var startTimeOfTestGeneration: Double = 0.0
31+
var latencyOfTestGeneration: Double = 0.0
3132
var isCodeBlockSelected: Boolean = false
3233
var srcPayloadSize: Long = 0
3334
var srcZipFileSize: Long = 0

0 commit comments

Comments
 (0)