Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

telemetry(amazonq): add metric for transformation type #6284

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 32 additions & 20 deletions packages/core/src/amazonqGumby/chat/controller/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,29 +269,41 @@ export class GumbyController {
}

private async handleLanguageUpgrade(message: any) {
try {
await this.beginTransformation(message)
const validProjects = await this.validateLanguageUpgradeProjects(message)
if (validProjects.length > 0) {
this.sessionStorage.getSession().updateCandidateProjects(validProjects)
await this.messenger.sendLanguageUpgradeProjectPrompt(validProjects, message.tabID)
}
} catch (err: any) {
getLogger().error(`Error handling language upgrade: ${err}`)
}
await telemetry.codeTransform_submitSelection
.run(async () => {
telemetry.record({
codeTransformSessionId: CodeTransformTelemetryState.instance.getSessionId(),
userChoice: 'language upgrade',
})
await this.beginTransformation(message)
const validProjects = await this.validateLanguageUpgradeProjects(message)
if (validProjects.length > 0) {
this.sessionStorage.getSession().updateCandidateProjects(validProjects)
await this.messenger.sendLanguageUpgradeProjectPrompt(validProjects, message.tabID)
}
})
.catch((err) => {
getLogger().error(`Error handling language upgrade: ${err}`)
})
}

private async handleSQLConversion(message: any) {
try {
await this.beginTransformation(message)
const validProjects = await this.validateSQLConversionProjects(message)
if (validProjects.length > 0) {
this.sessionStorage.getSession().updateCandidateProjects(validProjects)
await this.messenger.sendSelectSQLMetadataFileMessage(message.tabID)
}
} catch (err: any) {
getLogger().error(`Error handling SQL conversion: ${err}`)
}
await telemetry.codeTransform_submitSelection
.run(async () => {
telemetry.record({
codeTransformSessionId: CodeTransformTelemetryState.instance.getSessionId(),
userChoice: 'sql conversion',
})
await this.beginTransformation(message)
const validProjects = await this.validateSQLConversionProjects(message)
if (validProjects.length > 0) {
this.sessionStorage.getSession().updateCandidateProjects(validProjects)
await this.messenger.sendSelectSQLMetadataFileMessage(message.tabID)
}
})
.catch((err) => {
getLogger().error(`Error handling SQL conversion: ${err}`)
Copy link
Contributor

@justinmk3 justinmk3 Dec 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: if the exception is caught then run() won't reflect a result=Failed.

If handleSQLConversion is called from a command or webview, the extension global handler will log the error and show a useful message to the user. If not, then the next best approach is to let the exception through, but add .catch(...) to the run() call.

Same for the other case in this PR.

})
}

private async validateLanguageUpgradeProjects(message: any) {
Expand Down
Loading