From e093326cd657d887ac26d95c15334de25ba9428d Mon Sep 17 00:00:00 2001 From: David Hasani Date: Wed, 30 Oct 2024 12:21:09 -0700 Subject: [PATCH 01/14] telemetry(amazonq): emit more metrics for code transformation --- .../codewhisperer/client/user-service-2.json | 2 +- .../core/src/codewhisperer/models/model.ts | 9 +++++++ .../transformByQ/transformApiHandler.ts | 1 + .../transformationResultsViewProvider.ts | 24 +++++++++++++++++++ .../core/src/shared/utilities/download.ts | 1 + 5 files changed, 36 insertions(+), 1 deletion(-) diff --git a/packages/core/src/codewhisperer/client/user-service-2.json b/packages/core/src/codewhisperer/client/user-service-2.json index c3233bc8b6c..8fc86f52bdc 100644 --- a/packages/core/src/codewhisperer/client/user-service-2.json +++ b/packages/core/src/codewhisperer/client/user-service-2.json @@ -2961,4 +2961,4 @@ "min": 0 } } -} +} \ No newline at end of file diff --git a/packages/core/src/codewhisperer/models/model.ts b/packages/core/src/codewhisperer/models/model.ts index 257ffedb403..b8f70978f08 100644 --- a/packages/core/src/codewhisperer/models/model.ts +++ b/packages/core/src/codewhisperer/models/model.ts @@ -412,6 +412,7 @@ export class TransformByQState { private sourceServerName: string = '' private metadataPathSQL: string = '' + private linesOfCodeSubmitted: number | undefined = undefined private planFilePath: string = '' private summaryFilePath: string = '' @@ -485,6 +486,10 @@ export class TransformByQState { return this.customBuildCommand } + public getLinesOfCodeSubmitted() { + return this.linesOfCodeSubmitted + } + public getPreBuildLogFilePath() { return this.preBuildLogFilePath } @@ -645,6 +650,10 @@ export class TransformByQState { this.customBuildCommand = command } + public setLinesOfCodeSubmitted(lines: number) { + this.linesOfCodeSubmitted = lines + } + public setStartTime(time: string) { this.startTime = time } diff --git a/packages/core/src/codewhisperer/service/transformByQ/transformApiHandler.ts b/packages/core/src/codewhisperer/service/transformByQ/transformApiHandler.ts index 55cd7797e5e..745f0942e45 100644 --- a/packages/core/src/codewhisperer/service/transformByQ/transformApiHandler.ts +++ b/packages/core/src/codewhisperer/service/transformByQ/transformApiHandler.ts @@ -573,6 +573,7 @@ export async function getTransformationPlan(jobId: string) { const linesOfCode = Number( jobStatistics.find((stat: { name: string; value: string }) => stat.name === 'linesOfCode').value ) + transformByQState.setLinesOfCodeSubmitted(linesOfCode) if (authType === 'iamIdentityCenter' && linesOfCode > CodeWhispererConstants.codeTransformLocThreshold) { plan += CodeWhispererConstants.codeTransformBillingText(linesOfCode) } diff --git a/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts b/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts index 2f75795c251..44d86cf34e5 100644 --- a/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts +++ b/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts @@ -20,6 +20,7 @@ import * as CodeWhispererConstants from '../../models/constants' import { createCodeWhispererChatStreamingClient } from '../../../shared/clients/codewhispererChatClient' import { ChatSessionManager } from '../../../amazonqGumby/chat/storages/chatSession' import { setContext } from '../../../shared/vscode/setContext' +import { codeWhispererClient } from '../../indexNode' export abstract class ProposedChangeNode { abstract readonly resourcePath: string @@ -402,6 +403,29 @@ export class ProposedTransformationExplorer { `${CodeWhispererConstants.errorDeserializingDiffNotification} ${deserializeErrorMessage}` ) } + + try { + const metricsPath = path.join(pathContainingArchive, ExportResultArchiveStructure.PathToMetrics) + const metricsData = JSON.parse(fs.readFileSync(metricsPath, 'utf8')) + + codeWhispererClient.sendTelemetryEvent({ + telemetryEvent: { + transformEvent: { + jobId: transformByQState.getJobId(), + timestamp: new Date(), + ideCategory: 'VSCODE', + programmingLanguage: { + languageName: 'JAVA', // TO-DO: use transformByQState.getTransformationType() to tell if JAVA or SQL + }, + linesOfCodeChanged: metricsData.linesOfCodeChanged, + charsOfCodeChanged: metricsData.charsOfCodeChanged, + linesOfCodeSubmitted: transformByQState.getLinesOfCodeSubmitted(), + }, + }, + }) + } catch (err: any) { + getLogger().error(`CodeTransformation: SendTelemetryEvent error = ${err.message}`) + } }) vscode.commands.registerCommand('aws.amazonq.transformationHub.reviewChanges.acceptChanges', async () => { diff --git a/packages/core/src/shared/utilities/download.ts b/packages/core/src/shared/utilities/download.ts index 8c9f5479ac0..63c8178a219 100644 --- a/packages/core/src/shared/utilities/download.ts +++ b/packages/core/src/shared/utilities/download.ts @@ -14,6 +14,7 @@ import fs from '../fs/fs' export class ExportResultArchiveStructure { static readonly PathToSummary = path.join('summary', 'summary.md') static readonly PathToDiffPatch = path.join('patch', 'diff.patch') + static readonly PathToMetrics = path.join('metrics', 'metrics.json') static readonly PathToManifest = 'manifest.json' } From 10640bdbdee82f73dc6b7468d6ea8b26d3e07661 Mon Sep 17 00:00:00 2001 From: David Hasani Date: Wed, 30 Oct 2024 14:36:54 -0700 Subject: [PATCH 02/14] fix lint error --- .../service/transformByQ/transformationResultsViewProvider.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts b/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts index 44d86cf34e5..207c7d64e46 100644 --- a/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts +++ b/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts @@ -408,7 +408,7 @@ export class ProposedTransformationExplorer { const metricsPath = path.join(pathContainingArchive, ExportResultArchiveStructure.PathToMetrics) const metricsData = JSON.parse(fs.readFileSync(metricsPath, 'utf8')) - codeWhispererClient.sendTelemetryEvent({ + await codeWhispererClient.sendTelemetryEvent({ telemetryEvent: { transformEvent: { jobId: transformByQState.getJobId(), From 16844572dc0e907884e378691ce315778e1460da Mon Sep 17 00:00:00 2001 From: David Hasani Date: Thu, 31 Oct 2024 09:42:50 -0700 Subject: [PATCH 03/14] use correct cwspr client import --- .../service/transformByQ/transformationResultsViewProvider.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts b/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts index 207c7d64e46..f3f174be3c7 100644 --- a/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts +++ b/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts @@ -20,7 +20,7 @@ import * as CodeWhispererConstants from '../../models/constants' import { createCodeWhispererChatStreamingClient } from '../../../shared/clients/codewhispererChatClient' import { ChatSessionManager } from '../../../amazonqGumby/chat/storages/chatSession' import { setContext } from '../../../shared/vscode/setContext' -import { codeWhispererClient } from '../../indexNode' +import * as codeWhisperer from '../../client/codewhisperer' export abstract class ProposedChangeNode { abstract readonly resourcePath: string @@ -408,7 +408,7 @@ export class ProposedTransformationExplorer { const metricsPath = path.join(pathContainingArchive, ExportResultArchiveStructure.PathToMetrics) const metricsData = JSON.parse(fs.readFileSync(metricsPath, 'utf8')) - await codeWhispererClient.sendTelemetryEvent({ + await codeWhisperer.codeWhispererClient.sendTelemetryEvent({ telemetryEvent: { transformEvent: { jobId: transformByQState.getJobId(), From 2fd136bd8e63983d40f770b00168e1ffb7da65bc Mon Sep 17 00:00:00 2001 From: David Hasani Date: Fri, 1 Nov 2024 12:13:31 -0700 Subject: [PATCH 04/14] move comment --- .../transformByQ/transformationResultsViewProvider.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts b/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts index f3f174be3c7..ff0e674ec7f 100644 --- a/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts +++ b/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts @@ -408,6 +408,11 @@ export class ProposedTransformationExplorer { const metricsPath = path.join(pathContainingArchive, ExportResultArchiveStructure.PathToMetrics) const metricsData = JSON.parse(fs.readFileSync(metricsPath, 'utf8')) + console.log('locChanged = ', metricsData.linesOfCodeChanged) + console.log('charsChanged = ', metricsData.charsOfCodeChanged) + console.log('linesSubmitted = ', transformByQState.getLinesOfCodeSubmitted()) + + // TO-DO: add support for SQL conversions; right now these metrics are only available for Java upgrades await codeWhisperer.codeWhispererClient.sendTelemetryEvent({ telemetryEvent: { transformEvent: { @@ -415,7 +420,7 @@ export class ProposedTransformationExplorer { timestamp: new Date(), ideCategory: 'VSCODE', programmingLanguage: { - languageName: 'JAVA', // TO-DO: use transformByQState.getTransformationType() to tell if JAVA or SQL + languageName: 'JAVA', }, linesOfCodeChanged: metricsData.linesOfCodeChanged, charsOfCodeChanged: metricsData.charsOfCodeChanged, From ddda95d4101c66eaac386ddc40a1d686d12d40d9 Mon Sep 17 00:00:00 2001 From: David <60020664+dhasani23@users.noreply.github.com> Date: Fri, 1 Nov 2024 12:18:10 -0700 Subject: [PATCH 05/14] feat(amazonq): support SQL conversions (#5775) QCT wants to support converting embedded SQL in Java apps. Allow users to start a transformation for SQL conversions. --- License: I confirm that my contribution is made under the terms of the Apache 2.0 license. --------- Co-authored-by: David Hasani --- packages/core/src/codewhisperer/models/model.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/core/src/codewhisperer/models/model.ts b/packages/core/src/codewhisperer/models/model.ts index b8f70978f08..052072e8f83 100644 --- a/packages/core/src/codewhisperer/models/model.ts +++ b/packages/core/src/codewhisperer/models/model.ts @@ -413,6 +413,17 @@ export class TransformByQState { private metadataPathSQL: string = '' private linesOfCodeSubmitted: number | undefined = undefined + private sourceDB: DB | undefined = undefined + + private targetDB: DB | undefined = undefined + + private schema: string = '' + + private schemaOptions: Set = new Set() + + private sourceServerName: string = '' + + private metadataPathSQL: string = '' private planFilePath: string = '' private summaryFilePath: string = '' From 29cf15865fd8cbc9614ebe0e4bd44f9425e7a2ef Mon Sep 17 00:00:00 2001 From: David Hasani Date: Wed, 30 Oct 2024 12:21:09 -0700 Subject: [PATCH 06/14] telemetry(amazonq): emit more metrics for code transformation --- packages/core/src/codewhisperer/models/model.ts | 12 +----------- .../transformationResultsViewProvider.ts | 9 ++------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/packages/core/src/codewhisperer/models/model.ts b/packages/core/src/codewhisperer/models/model.ts index 052072e8f83..117c0934091 100644 --- a/packages/core/src/codewhisperer/models/model.ts +++ b/packages/core/src/codewhisperer/models/model.ts @@ -412,18 +412,8 @@ export class TransformByQState { private sourceServerName: string = '' private metadataPathSQL: string = '' - private linesOfCodeSubmitted: number | undefined = undefined - private sourceDB: DB | undefined = undefined - - private targetDB: DB | undefined = undefined - - private schema: string = '' - private schemaOptions: Set = new Set() - - private sourceServerName: string = '' - - private metadataPathSQL: string = '' + private linesOfCodeSubmitted: number | undefined = undefined private planFilePath: string = '' private summaryFilePath: string = '' diff --git a/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts b/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts index ff0e674ec7f..303e9691699 100644 --- a/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts +++ b/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts @@ -408,19 +408,14 @@ export class ProposedTransformationExplorer { const metricsPath = path.join(pathContainingArchive, ExportResultArchiveStructure.PathToMetrics) const metricsData = JSON.parse(fs.readFileSync(metricsPath, 'utf8')) - console.log('locChanged = ', metricsData.linesOfCodeChanged) - console.log('charsChanged = ', metricsData.charsOfCodeChanged) - console.log('linesSubmitted = ', transformByQState.getLinesOfCodeSubmitted()) - - // TO-DO: add support for SQL conversions; right now these metrics are only available for Java upgrades - await codeWhisperer.codeWhispererClient.sendTelemetryEvent({ + codeWhisperer.codeWhispererClient.sendTelemetryEvent({ telemetryEvent: { transformEvent: { jobId: transformByQState.getJobId(), timestamp: new Date(), ideCategory: 'VSCODE', programmingLanguage: { - languageName: 'JAVA', + languageName: 'JAVA', // TO-DO: use transformByQState.getTransformationType() to tell if JAVA or SQL }, linesOfCodeChanged: metricsData.linesOfCodeChanged, charsOfCodeChanged: metricsData.charsOfCodeChanged, From d6e28cb83bd02703d9e2e419e0b324dfca3b1d70 Mon Sep 17 00:00:00 2001 From: David Hasani Date: Fri, 1 Nov 2024 14:48:07 -0700 Subject: [PATCH 07/14] add SQL language type to metric --- .../transformByQ/transformationResultsViewProvider.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts b/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts index 303e9691699..480a686a626 100644 --- a/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts +++ b/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts @@ -10,7 +10,7 @@ import { parsePatch, applyPatches, ParsedDiff } from 'diff' import path from 'path' import vscode from 'vscode' import { ExportIntent } from '@amzn/codewhisperer-streaming' -import { TransformByQReviewStatus, transformByQState } from '../../models/model' +import { TransformationType, TransformByQReviewStatus, transformByQState } from '../../models/model' import { ExportResultArchiveStructure, downloadExportResultArchive } from '../../../shared/utilities/download' import { getLogger } from '../../../shared/logger' import { telemetry } from '../../../shared/telemetry/telemetry' @@ -408,14 +408,18 @@ export class ProposedTransformationExplorer { const metricsPath = path.join(pathContainingArchive, ExportResultArchiveStructure.PathToMetrics) const metricsData = JSON.parse(fs.readFileSync(metricsPath, 'utf8')) - codeWhisperer.codeWhispererClient.sendTelemetryEvent({ + // TO-DO: add support for SQL conversions; right now these metrics are only available for Java upgrades + await codeWhisperer.codeWhispererClient.sendTelemetryEvent({ telemetryEvent: { transformEvent: { jobId: transformByQState.getJobId(), timestamp: new Date(), ideCategory: 'VSCODE', programmingLanguage: { - languageName: 'JAVA', // TO-DO: use transformByQState.getTransformationType() to tell if JAVA or SQL + languageName: + transformByQState.getTransformationType() === TransformationType.LANGUAGE_UPGRADE + ? 'JAVA' + : 'SQL', }, linesOfCodeChanged: metricsData.linesOfCodeChanged, charsOfCodeChanged: metricsData.charsOfCodeChanged, From cfccb01f971c207e7ff5fb4d9f20fefac4e5a5ce Mon Sep 17 00:00:00 2001 From: David Hasani Date: Mon, 4 Nov 2024 12:30:03 -0800 Subject: [PATCH 08/14] typo --- .../service/transformByQ/transformationResultsViewProvider.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts b/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts index 480a686a626..b6002d47741 100644 --- a/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts +++ b/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts @@ -422,7 +422,7 @@ export class ProposedTransformationExplorer { : 'SQL', }, linesOfCodeChanged: metricsData.linesOfCodeChanged, - charsOfCodeChanged: metricsData.charsOfCodeChanged, + charsOfCodeChanged: metricsData.charactersOfCodeChanged, linesOfCodeSubmitted: transformByQState.getLinesOfCodeSubmitted(), }, }, From 5b019e7d8fd9200748125195743438af8cf990cd Mon Sep 17 00:00:00 2001 From: David Hasani Date: Tue, 5 Nov 2024 13:22:54 -0800 Subject: [PATCH 09/14] address comment --- .../transformByQ/transformationResultsViewProvider.ts | 3 +-- packages/core/src/shared/utilities/download.ts | 7 +++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts b/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts index b6002d47741..f20ef7576a3 100644 --- a/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts +++ b/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts @@ -408,7 +408,6 @@ export class ProposedTransformationExplorer { const metricsPath = path.join(pathContainingArchive, ExportResultArchiveStructure.PathToMetrics) const metricsData = JSON.parse(fs.readFileSync(metricsPath, 'utf8')) - // TO-DO: add support for SQL conversions; right now these metrics are only available for Java upgrades await codeWhisperer.codeWhispererClient.sendTelemetryEvent({ telemetryEvent: { transformEvent: { @@ -423,7 +422,7 @@ export class ProposedTransformationExplorer { }, linesOfCodeChanged: metricsData.linesOfCodeChanged, charsOfCodeChanged: metricsData.charactersOfCodeChanged, - linesOfCodeSubmitted: transformByQState.getLinesOfCodeSubmitted(), + linesOfCodeSubmitted: transformByQState.getLinesOfCodeSubmitted(), // currently unavailable for SQL conversions }, }, }) diff --git a/packages/core/src/shared/utilities/download.ts b/packages/core/src/shared/utilities/download.ts index 63c8178a219..dfb4c551427 100644 --- a/packages/core/src/shared/utilities/download.ts +++ b/packages/core/src/shared/utilities/download.ts @@ -3,7 +3,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -import path from 'path' import { CodeWhispererStreaming, ExportResultArchiveCommandInput } from '@amzn/codewhisperer-streaming' import { ToolkitError } from '../errors' import fs from '../fs/fs' @@ -12,9 +11,9 @@ import fs from '../fs/fs' * This class represents the structure of the archive returned by the ExportResultArchive endpoint */ export class ExportResultArchiveStructure { - static readonly PathToSummary = path.join('summary', 'summary.md') - static readonly PathToDiffPatch = path.join('patch', 'diff.patch') - static readonly PathToMetrics = path.join('metrics', 'metrics.json') + static readonly PathToSummary = 'summary/summary.md' + static readonly PathToDiffPatch = 'patch/diff.patch' + static readonly PathToMetrics = 'metrics/metrics.json' static readonly PathToManifest = 'manifest.json' } From 5af3494725145c4d062f8300a7461091f99324a9 Mon Sep 17 00:00:00 2001 From: David Hasani Date: Fri, 8 Nov 2024 15:45:05 -0800 Subject: [PATCH 10/14] update api model --- packages/core/src/codewhisperer/client/codewhisperer.ts | 2 ++ packages/core/src/codewhisperer/client/user-service-2.json | 2 +- .../transformByQ/transformationResultsViewProvider.ts | 5 +++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/core/src/codewhisperer/client/codewhisperer.ts b/packages/core/src/codewhisperer/client/codewhisperer.ts index 5104ef7ede0..392e7340b84 100644 --- a/packages/core/src/codewhisperer/client/codewhisperer.ts +++ b/packages/core/src/codewhisperer/client/codewhisperer.ts @@ -258,7 +258,9 @@ export class DefaultCodeWhispererClient { if (!AuthUtil.instance.isValidEnterpriseSsoInUse() && !globals.telemetry.telemetryEnabled) { return } + console.log('about to make API call') const response = await (await this.createUserSdkClient()).sendTelemetryEvent(requestWithCommonFields).promise() + console.log('API call response =', response) getLogger().debug(`codewhisperer: sendTelemetryEvent requestID: ${response.$response.requestId}`) } diff --git a/packages/core/src/codewhisperer/client/user-service-2.json b/packages/core/src/codewhisperer/client/user-service-2.json index 8fc86f52bdc..c3233bc8b6c 100644 --- a/packages/core/src/codewhisperer/client/user-service-2.json +++ b/packages/core/src/codewhisperer/client/user-service-2.json @@ -2961,4 +2961,4 @@ "min": 0 } } -} \ No newline at end of file +} diff --git a/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts b/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts index f20ef7576a3..79b31da450f 100644 --- a/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts +++ b/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts @@ -408,6 +408,11 @@ export class ProposedTransformationExplorer { const metricsPath = path.join(pathContainingArchive, ExportResultArchiveStructure.PathToMetrics) const metricsData = JSON.parse(fs.readFileSync(metricsPath, 'utf8')) + console.log('metricsData.linesOfCodeChanged =', metricsData.linesOfCodeChanged) + console.log('metricsData.charactersOfCodeChanged =', metricsData.charactersOfCodeChanged) + console.log('linesOfCodeSubmitted =', transformByQState.getLinesOfCodeSubmitted()) + console.log('transformByQState.getTransformationType() =', transformByQState.getTransformationType()) + await codeWhisperer.codeWhispererClient.sendTelemetryEvent({ telemetryEvent: { transformEvent: { From 048a720d843a83d91d84ea9f2e0a1762da226b8d Mon Sep 17 00:00:00 2001 From: David Hasani Date: Fri, 8 Nov 2024 16:32:36 -0800 Subject: [PATCH 11/14] remove console.log statements --- packages/core/src/codewhisperer/client/codewhisperer.ts | 2 -- .../transformByQ/transformationResultsViewProvider.ts | 5 ----- 2 files changed, 7 deletions(-) diff --git a/packages/core/src/codewhisperer/client/codewhisperer.ts b/packages/core/src/codewhisperer/client/codewhisperer.ts index 392e7340b84..5104ef7ede0 100644 --- a/packages/core/src/codewhisperer/client/codewhisperer.ts +++ b/packages/core/src/codewhisperer/client/codewhisperer.ts @@ -258,9 +258,7 @@ export class DefaultCodeWhispererClient { if (!AuthUtil.instance.isValidEnterpriseSsoInUse() && !globals.telemetry.telemetryEnabled) { return } - console.log('about to make API call') const response = await (await this.createUserSdkClient()).sendTelemetryEvent(requestWithCommonFields).promise() - console.log('API call response =', response) getLogger().debug(`codewhisperer: sendTelemetryEvent requestID: ${response.$response.requestId}`) } diff --git a/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts b/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts index 79b31da450f..f20ef7576a3 100644 --- a/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts +++ b/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts @@ -408,11 +408,6 @@ export class ProposedTransformationExplorer { const metricsPath = path.join(pathContainingArchive, ExportResultArchiveStructure.PathToMetrics) const metricsData = JSON.parse(fs.readFileSync(metricsPath, 'utf8')) - console.log('metricsData.linesOfCodeChanged =', metricsData.linesOfCodeChanged) - console.log('metricsData.charactersOfCodeChanged =', metricsData.charactersOfCodeChanged) - console.log('linesOfCodeSubmitted =', transformByQState.getLinesOfCodeSubmitted()) - console.log('transformByQState.getTransformationType() =', transformByQState.getTransformationType()) - await codeWhisperer.codeWhispererClient.sendTelemetryEvent({ telemetryEvent: { transformEvent: { From a51edcbca47c0384f1043be390f98addc2374d71 Mon Sep 17 00:00:00 2001 From: David Hasani Date: Fri, 8 Nov 2024 16:40:56 -0800 Subject: [PATCH 12/14] add small comment --- .../service/transformByQ/transformationResultsViewProvider.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts b/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts index f20ef7576a3..eab339df718 100644 --- a/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts +++ b/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts @@ -427,6 +427,7 @@ export class ProposedTransformationExplorer { }, }) } catch (err: any) { + // log error, but continue to show user diff.patch with results getLogger().error(`CodeTransformation: SendTelemetryEvent error = ${err.message}`) } }) From ac37b5be397862562a0e2b1cf56fc797f3d71e19 Mon Sep 17 00:00:00 2001 From: David Hasani Date: Wed, 13 Nov 2024 08:55:50 -0800 Subject: [PATCH 13/14] add userContext --- .../transformByQ/transformationResultsViewProvider.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts b/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts index eab339df718..813a3e665db 100644 --- a/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts +++ b/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts @@ -21,6 +21,7 @@ import { createCodeWhispererChatStreamingClient } from '../../../shared/clients/ import { ChatSessionManager } from '../../../amazonqGumby/chat/storages/chatSession' import { setContext } from '../../../shared/vscode/setContext' import * as codeWhisperer from '../../client/codewhisperer' +import { getOperatingSystem } from '../../../shared/telemetry/util' export abstract class ProposedChangeNode { abstract readonly resourcePath: string @@ -425,6 +426,11 @@ export class ProposedTransformationExplorer { linesOfCodeSubmitted: transformByQState.getLinesOfCodeSubmitted(), // currently unavailable for SQL conversions }, }, + userContext: { + ideCategory: 'VSCODE', + operatingSystem: getOperatingSystem(), + product: 'CodeWhisperer', + }, }) } catch (err: any) { // log error, but continue to show user diff.patch with results From 7c54065849be088d263c2e5c993e595eabe9a592 Mon Sep 17 00:00:00 2001 From: David Hasani Date: Wed, 13 Nov 2024 10:10:01 -0800 Subject: [PATCH 14/14] remove redundant userContext --- .../transformByQ/transformationResultsViewProvider.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts b/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts index 813a3e665db..eab339df718 100644 --- a/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts +++ b/packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts @@ -21,7 +21,6 @@ import { createCodeWhispererChatStreamingClient } from '../../../shared/clients/ import { ChatSessionManager } from '../../../amazonqGumby/chat/storages/chatSession' import { setContext } from '../../../shared/vscode/setContext' import * as codeWhisperer from '../../client/codewhisperer' -import { getOperatingSystem } from '../../../shared/telemetry/util' export abstract class ProposedChangeNode { abstract readonly resourcePath: string @@ -426,11 +425,6 @@ export class ProposedTransformationExplorer { linesOfCodeSubmitted: transformByQState.getLinesOfCodeSubmitted(), // currently unavailable for SQL conversions }, }, - userContext: { - ideCategory: 'VSCODE', - operatingSystem: getOperatingSystem(), - product: 'CodeWhisperer', - }, }) } catch (err: any) { // log error, but continue to show user diff.patch with results