-
Notifications
You must be signed in to change notification settings - Fork 472
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): emit TransformEvent metric from download ZIP #5905
Changes from 13 commits
e093326
10640bd
1684457
2fd136b
ddda95d
29cf158
d6e28cb
cfccb01
5b019e7
5af3494
048a720
a51edcb
ac37b5b
7c54065
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -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' | ||||
|
@@ -20,6 +20,8 @@ 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 * as codeWhisperer from '../../client/codewhisperer' | ||||
import { getOperatingSystem } from '../../../shared/telemetry/util' | ||||
|
||||
export abstract class ProposedChangeNode { | ||||
abstract readonly resourcePath: string | ||||
|
@@ -402,6 +404,38 @@ export class ProposedTransformationExplorer { | |||
`${CodeWhispererConstants.errorDeserializingDiffNotification} ${deserializeErrorMessage}` | ||||
) | ||||
} | ||||
|
||||
try { | ||||
const metricsPath = path.join(pathContainingArchive, ExportResultArchiveStructure.PathToMetrics) | ||||
const metricsData = JSON.parse(fs.readFileSync(metricsPath, 'utf8')) | ||||
|
||||
await codeWhisperer.codeWhispererClient.sendTelemetryEvent({ | ||||
telemetryEvent: { | ||||
transformEvent: { | ||||
jobId: transformByQState.getJobId(), | ||||
timestamp: new Date(), | ||||
ideCategory: 'VSCODE', | ||||
programmingLanguage: { | ||||
languageName: | ||||
transformByQState.getTransformationType() === TransformationType.LANGUAGE_UPGRADE | ||||
? 'JAVA' | ||||
: 'SQL', | ||||
}, | ||||
linesOfCodeChanged: metricsData.linesOfCodeChanged, | ||||
charsOfCodeChanged: metricsData.charactersOfCodeChanged, | ||||
linesOfCodeSubmitted: transformByQState.getLinesOfCodeSubmitted(), // currently unavailable for SQL conversions | ||||
}, | ||||
}, | ||||
userContext: { | ||||
ideCategory: 'VSCODE', | ||||
operatingSystem: getOperatingSystem(), | ||||
product: 'CodeWhisperer', | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should it be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep that makes more sense There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On second thought, I shouldn't even be manually including this
|
||||
}, | ||||
}) | ||||
} catch (err: any) { | ||||
// log error, but continue to show user diff.patch with results | ||||
getLogger().error(`CodeTransformation: SendTelemetryEvent error = ${err.message}`) | ||||
} | ||||
}) | ||||
|
||||
vscode.commands.registerCommand('aws.amazonq.transformationHub.reviewChanges.acceptChanges', async () => { | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any constant value we can extract this
VSCODE
value from? Same forJAVA
andSQL
belowThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, do we have enum e.g.
IdeCategory
or constants represent IDE or get it from IDE env ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see this no. All other uses in toolkit seem to use
VSCODE
just like this