From 76ffb5d08570c708d1769e7667814886767ad6b1 Mon Sep 17 00:00:00 2001 From: Lei Gao Date: Wed, 16 Oct 2024 11:22:26 -0700 Subject: [PATCH 1/3] fix memory report telemetry --- .../bugfix-16f02728-142e-4020-b24d-eff66ecd17e9.json | 4 ++++ .../cwc/editor/context/project/ProjectContextProvider.kt | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 .changes/next-release/bugfix-16f02728-142e-4020-b24d-eff66ecd17e9.json diff --git a/.changes/next-release/bugfix-16f02728-142e-4020-b24d-eff66ecd17e9.json b/.changes/next-release/bugfix-16f02728-142e-4020-b24d-eff66ecd17e9.json new file mode 100644 index 0000000000..43cae45373 --- /dev/null +++ b/.changes/next-release/bugfix-16f02728-142e-4020-b24d-eff66ecd17e9.json @@ -0,0 +1,4 @@ +{ + "type" : "bugfix", + "description" : "Fix language server memory usage telemetry" +} \ No newline at end of file diff --git a/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/editor/context/project/ProjectContextProvider.kt b/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/editor/context/project/ProjectContextProvider.kt index a31508f0b5..a627ddf861 100644 --- a/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/editor/context/project/ProjectContextProvider.kt +++ b/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/editor/context/project/ProjectContextProvider.kt @@ -162,7 +162,7 @@ class ProjectContextProvider(val project: Project, private val encoderServer: En logger.debug { "project context index time: ${duration}ms" } if (connection.responseCode == 200) { val usage = getUsage() - TelemetryHelper.recordIndexWorkspace(duration, filesResult.files.size, filesResult.fileSize, true, usage?.memoryUsage, usage?.cpuUsage, startUrl) + TelemetryHelper.recordIndexWorkspace(duration, filesResult.files.size, filesResult.fileSize, true, usage?.memoryUsage?.div(1024 * 1024), usage?.cpuUsage, startUrl) logger.debug { "project context index finished for ${project.name}" } return true } else { From 0bbf451d926d302df07c21e4250a9b51760b113f Mon Sep 17 00:00:00 2001 From: Lei Gao Date: Thu, 17 Oct 2024 09:43:35 -0700 Subject: [PATCH 2/3] rm extra change log --- .../bugfix-16f02728-142e-4020-b24d-eff66ecd17e9.json | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 .changes/next-release/bugfix-16f02728-142e-4020-b24d-eff66ecd17e9.json diff --git a/.changes/next-release/bugfix-16f02728-142e-4020-b24d-eff66ecd17e9.json b/.changes/next-release/bugfix-16f02728-142e-4020-b24d-eff66ecd17e9.json deleted file mode 100644 index 43cae45373..0000000000 --- a/.changes/next-release/bugfix-16f02728-142e-4020-b24d-eff66ecd17e9.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "type" : "bugfix", - "description" : "Fix language server memory usage telemetry" -} \ No newline at end of file From 5534508712988cfe641468c4caf739001501a62e Mon Sep 17 00:00:00 2001 From: Lei Gao Date: Thu, 17 Oct 2024 11:17:43 -0700 Subject: [PATCH 3/3] detekt --- .../editor/context/project/ProjectContextProvider.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/editor/context/project/ProjectContextProvider.kt b/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/editor/context/project/ProjectContextProvider.kt index a627ddf861..ca5fc048d0 100644 --- a/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/editor/context/project/ProjectContextProvider.kt +++ b/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/editor/context/project/ProjectContextProvider.kt @@ -162,7 +162,15 @@ class ProjectContextProvider(val project: Project, private val encoderServer: En logger.debug { "project context index time: ${duration}ms" } if (connection.responseCode == 200) { val usage = getUsage() - TelemetryHelper.recordIndexWorkspace(duration, filesResult.files.size, filesResult.fileSize, true, usage?.memoryUsage?.div(1024 * 1024), usage?.cpuUsage, startUrl) + TelemetryHelper.recordIndexWorkspace( + duration, + filesResult.files.size, + filesResult.fileSize, + true, + usage?.memoryUsage?.div(1024 * 1024), + usage?.cpuUsage, + startUrl + ) logger.debug { "project context index finished for ${project.name}" } return true } else {