Skip to content

Commit ec3d928

Browse files
ntarakad-awslaileni-aws
authored andcommitted
telemetry(amazon q): metrics after one/multiple diffs form selection aws#6138
## Problem We were only recording the metrics when the user accepts changes so we can track which patches were applied based on their description. We wanted to also keep track of the form in which the user is prompted to pick whether they want their changes in one or multiple diffs. ## Solution Adding a telemetry call when we handle the form selection for selective transformation one or multiple diffs.
1 parent 2943a76 commit ec3d928

File tree

2 files changed

+31
-22
lines changed

2 files changed

+31
-22
lines changed

packages/core/src/amazonq/webview/ui/quickActions/generator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export class QuickActionGenerator {
8686
? [
8787
{
8888
command: '/transform',
89-
description: 'Transform your Java 8 or 11 Maven project to Java 17',
89+
description: 'Transform your Java 8, 11, or 17 Maven projects',
9090
icon: MynahIcons.TRANSFORM,
9191
},
9292
]

packages/core/src/amazonqGumby/chat/controller/controller.ts

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -411,31 +411,40 @@ export class GumbyController {
411411
}
412412

413413
private async handleSkipTestsSelection(message: any) {
414-
const skipTestsSelection = message.formSelectedValues['GumbyTransformSkipTestsForm']
415-
if (skipTestsSelection === CodeWhispererConstants.skipUnitTestsMessage) {
416-
transformByQState.setCustomBuildCommand(CodeWhispererConstants.skipUnitTestsBuildCommand)
417-
} else {
418-
transformByQState.setCustomBuildCommand(CodeWhispererConstants.doNotSkipUnitTestsBuildCommand)
419-
}
420-
telemetry.codeTransform_submitSelection.emit({
421-
codeTransformSessionId: CodeTransformTelemetryState.instance.getSessionId(),
422-
userChoice: skipTestsSelection,
423-
result: MetadataResult.Pass,
414+
await telemetry.codeTransform_submitSelection.run(async () => {
415+
const skipTestsSelection = message.formSelectedValues['GumbyTransformSkipTestsForm']
416+
if (skipTestsSelection === CodeWhispererConstants.skipUnitTestsMessage) {
417+
transformByQState.setCustomBuildCommand(CodeWhispererConstants.skipUnitTestsBuildCommand)
418+
} else {
419+
transformByQState.setCustomBuildCommand(CodeWhispererConstants.doNotSkipUnitTestsBuildCommand)
420+
}
421+
telemetry.record({
422+
codeTransformSessionId: CodeTransformTelemetryState.instance.getSessionId(),
423+
userChoice: skipTestsSelection,
424+
})
425+
this.messenger.sendSkipTestsSelectionMessage(skipTestsSelection, message.tabID)
426+
await this.messenger.sendOneOrMultipleDiffsPrompt(message.tabID)
424427
})
425-
this.messenger.sendSkipTestsSelectionMessage(skipTestsSelection, message.tabID)
426-
await this.messenger.sendOneOrMultipleDiffsPrompt(message.tabID)
427428
}
428429

429430
private async handleOneOrMultipleDiffs(message: any) {
430-
const oneOrMultipleDiffsSelection = message.formSelectedValues['GumbyTransformOneOrMultipleDiffsForm']
431-
if (oneOrMultipleDiffsSelection === CodeWhispererConstants.multipleDiffsMessage) {
432-
transformByQState.setMultipleDiffs(true)
433-
} else {
434-
transformByQState.setMultipleDiffs(false)
435-
}
436-
this.messenger.sendOneOrMultipleDiffsMessage(oneOrMultipleDiffsSelection, message.tabID)
437-
// perform local build
438-
await this.validateBuildWithPromptOnError(message)
431+
await telemetry.codeTransform_submitSelection.run(async () => {
432+
const oneOrMultipleDiffsSelection = message.formSelectedValues['GumbyTransformOneOrMultipleDiffsForm']
433+
if (oneOrMultipleDiffsSelection === CodeWhispererConstants.multipleDiffsMessage) {
434+
transformByQState.setMultipleDiffs(true)
435+
} else {
436+
transformByQState.setMultipleDiffs(false)
437+
}
438+
439+
telemetry.record({
440+
codeTransformSessionId: CodeTransformTelemetryState.instance.getSessionId(),
441+
userChoice: oneOrMultipleDiffsSelection,
442+
})
443+
444+
this.messenger.sendOneOrMultipleDiffsMessage(oneOrMultipleDiffsSelection, message.tabID)
445+
// perform local build
446+
await this.validateBuildWithPromptOnError(message)
447+
})
439448
}
440449

441450
private async handleUserLanguageUpgradeProjectChoice(message: any) {

0 commit comments

Comments
 (0)