Skip to content

Commit

Permalink
telemetry(amazonq): add jobId to all metrics #6241
Browse files Browse the repository at this point in the history
## Problem
`jobId` missing in some metrics.


## Solution
Add it.
  • Loading branch information
dhasani23 authored Dec 13, 2024
1 parent 0371970 commit 5669e87
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
9 changes: 4 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"generateNonCodeFiles": "npm run generateNonCodeFiles -w packages/ --if-present"
},
"devDependencies": {
"@aws-toolkits/telemetry": "^1.0.287",
"@aws-toolkits/telemetry": "^1.0.289",
"@playwright/browser-chromium": "^1.43.1",
"@stylistic/eslint-plugin": "^2.11.0",
"@types/he": "^1.2.3",
Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/codewhisperer/commands/startTransformByQ.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ export async function preTransformationUploadCode() {

transformByQState.setPayloadFilePath(payloadFilePath)
uploadId = await uploadPayload(payloadFilePath)
telemetry.record({ codeTransformJobId: uploadId }) // uploadId is re-used as jobId
})
} catch (err) {
const errorMessage = (err as Error).message
Expand Down Expand Up @@ -735,15 +736,15 @@ export async function postTransformationJob() {
const mavenVersionInfoMessage = `${versionInfo[0]} (${transformByQState.getMavenName()})`
const javaVersionInfoMessage = `${versionInfo[1]} (${transformByQState.getMavenName()})`

// Note: IntelliJ implementation of ResultStatusMessage includes additional metadata such as jobId.
telemetry.codeTransform_totalRunTime.emit({
buildSystemVersion: mavenVersionInfoMessage,
codeTransformSessionId: CodeTransformTelemetryState.instance.getSessionId(),
codeTransformJobId: transformByQState.getJobId(),
codeTransformResultStatusMessage: resultStatusMessage,
codeTransformRunTimeLatency: durationInMs,
codeTransformLocalJavaVersion: javaVersionInfoMessage,
result: resultStatusMessage === TransformByQStatus.Succeeded ? MetadataResult.Pass : MetadataResult.Fail,
reason: resultStatusMessage,
reason: `${resultStatusMessage}-${chatMessage}`,
})
}

Expand Down Expand Up @@ -825,6 +826,7 @@ export async function stopTransformByQ(jobId: string) {
await telemetry.codeTransform_jobIsCancelledByUser.run(async () => {
telemetry.record({
codeTransformSessionId: CodeTransformTelemetryState.instance.getSessionId(),
codeTransformJobId: jobId,
})
if (transformByQState.isRunning()) {
getLogger().info('CodeTransformation: User requested to stop transformation. Stopping transformation.')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -536,9 +536,9 @@ export class ProposedTransformationExplorer {
diffModel.saveChanges()
telemetry.codeTransform_submitSelection.emit({
codeTransformSessionId: CodeTransformTelemetryState.instance.getSessionId(),
codeTransformJobId: transformByQState.getJobId(),
userChoice: `acceptChanges-${patchFilesDescriptions?.content[diffModel.currentPatchIndex].name}`,
})
telemetry.ui_click.emit({ elementId: 'transformationHub_acceptChanges' })
if (transformByQState.getMultipleDiffs()) {
void vscode.window.showInformationMessage(
CodeWhispererConstants.changesAppliedNotificationMultipleDiffs(
Expand Down Expand Up @@ -596,7 +596,6 @@ export class ProposedTransformationExplorer {
vscode.commands.registerCommand('aws.amazonq.transformationHub.reviewChanges.rejectChanges', async () => {
diffModel.rejectChanges()
await reset()
telemetry.ui_click.emit({ elementId: 'transformationHub_rejectChanges' })

transformByQState.getChatControllers()?.transformationFinished.fire({
tabID: ChatSessionManager.Instance.getSession().tabID,
Expand Down

0 comments on commit 5669e87

Please sign in to comment.