Skip to content

Commit 538545c

Browse files
author
David Hasani
committed
add metric
1 parent ea296f0 commit 538545c

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,14 @@ export class GumbyController {
680680

681681
case ConversationState.WAITING_FOR_TRANSFORMATION_OBJECTIVE: {
682682
const objective = data.message.trim().toLowerCase()
683+
// since we're prompting the user, their project(s) must be eligible for both types of transformations, so track how often this happens here
684+
if (objective === 'language upgrade' || objective === 'sql conversion') {
685+
telemetry.codeTransform_submitSelection.emit({
686+
codeTransformSessionId: CodeTransformTelemetryState.instance.getSessionId(),
687+
userChoice: objective,
688+
result: 'Succeeded',
689+
})
690+
}
683691
if (objective === 'language upgrade') {
684692
await this.handleLanguageUpgrade(data)
685693
} else if (objective === 'sql conversion') {

packages/core/src/codewhisperer/commands/startTransformByQ.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -650,14 +650,19 @@ export async function getValidSQLConversionCandidateProjects() {
650650
})
651651
const openProjects = await getOpenProjects()
652652
const javaProjects = await getJavaProjects(openProjects)
653+
let resultLog = ''
653654
for (const project of javaProjects) {
654655
// as long as at least one of these strings is found, project contains embedded SQL statements
655656
const searchStrings = ['oracle.jdbc.OracleDriver', 'jdbc:oracle:thin:@', 'jdbc:oracle:oci:@', 'jdbc:odbc:']
656657
for (const str of searchStrings) {
657658
const spawnResult = await findStringInDirectory(str, project.path)
658-
getLogger().info(
659-
`CodeTransformation: searching for ${str} in ${project.path}, status code = ${spawnResult.exitCode}`
660-
)
659+
// just for telemetry purposes
660+
if (spawnResult.error || spawnResult.stderr) {
661+
resultLog += `search failed: ${JSON.stringify(spawnResult)}`
662+
} else {
663+
resultLog += `search succeeded: ${spawnResult.exitCode}`
664+
}
665+
getLogger().info(`CodeTransformation: searching for ${str} in ${project.path}, result = ${resultLog}`)
661666
if (spawnResult.exitCode === 0) {
662667
embeddedSQLProjects.push(project)
663668
break
@@ -668,7 +673,7 @@ export async function getValidSQLConversionCandidateProjects() {
668673
`CodeTransformation: found ${embeddedSQLProjects.length} projects with embedded SQL statements`
669674
)
670675
telemetry.record({
671-
codeTransformMetadata: `Found ${embeddedSQLProjects.length} projects with embedded SQL`,
676+
codeTransformMetadata: resultLog,
672677
})
673678
})
674679
return embeddedSQLProjects

0 commit comments

Comments
 (0)