-
Notifications
You must be signed in to change notification settings - Fork 86
fix: Add programming language to ChatInteractWithMessageEvent #2575
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
base: main
Are you sure you want to change the base?
Changes from all commits
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 |
|---|---|---|
|
|
@@ -63,6 +63,7 @@ export class ChatTelemetryController { | |
| #tabTelemetryInfoByTabId: { [tabId: string]: ConversationTriggerInfo } | ||
| #currentTriggerByTabId: { [tabId: string]: TriggerType } = {} | ||
| #customizationInfoByTabAndMessageId: { [tabId: string]: { [messageId: string]: string } } | ||
| #programmingLanguageByTabId: { [tabId: string]: CodewhispererLanguage } = {} | ||
| #credentialsProvider: CredentialsProvider | ||
| #telemetry: Telemetry | ||
| #logging: Logging | ||
|
|
@@ -73,6 +74,7 @@ export class ChatTelemetryController { | |
| this.#tabTelemetryInfoByTabId = {} | ||
| this.#currentTriggerByTabId = {} | ||
| this.#customizationInfoByTabAndMessageId = {} | ||
| this.#programmingLanguageByTabId = {} | ||
| this.#telemetry = features.telemetry | ||
| this.#logging = features.logging | ||
| this.#credentialsProvider = features.credentialsProvider | ||
|
|
@@ -103,6 +105,10 @@ export class ChatTelemetryController { | |
| return tabId && messageId && this.#customizationInfoByTabAndMessageId[tabId]?.[messageId] | ||
| } | ||
|
|
||
| public getProgrammingLanguage(tabId: string) { | ||
| return this.#programmingLanguageByTabId[tabId] | ||
| } | ||
|
|
||
| public removeConversation(tabId: string) { | ||
| delete this.#tabTelemetryInfoByTabId[tabId] | ||
| delete this.#customizationInfoByTabAndMessageId[tabId] | ||
|
|
@@ -309,6 +315,10 @@ export class ChatTelemetryController { | |
| [metric.cwsprChatMessageId]: metric.codewhispererCustomizationArn, | ||
| } | ||
| } | ||
| // Store the programming language for this tab | ||
| if (metric.cwsprChatProgrammingLanguage) { | ||
| this.#programmingLanguageByTabId[tabId] = metric.cwsprChatProgrammingLanguage as CodewhispererLanguage | ||
| } | ||
| return this.#telemetryService.emitChatAddMessage( | ||
| { | ||
| conversationId: conversationId, | ||
|
|
@@ -555,6 +565,7 @@ export class ChatTelemetryController { | |
| } | ||
| await this.#telemetryService.emitChatInteractWithMessage(voteData, { | ||
|
Contributor
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. Could you clarify when this event will be emitted? |
||
| conversationId: this.getConversationId(params.tabId), | ||
| programmingLanguage: this.getProgrammingLanguage(params.tabId), | ||
| }) | ||
| break | ||
| case ChatUIEventName.InsertToCursorPosition: | ||
|
|
@@ -581,6 +592,7 @@ export class ChatTelemetryController { | |
| params.name === ChatUIEventName.InsertToCursorPosition | ||
| ? params.code?.split('\n').length | ||
| : undefined, | ||
| programmingLanguage: this.getProgrammingLanguage(params.tabId), | ||
| }) | ||
| break | ||
| case ChatUIEventName.LinkClick: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -322,6 +322,7 @@ | |
| options?: { | ||
| conversationId?: string | ||
| acceptedLineCount?: number | ||
| programmingLanguage?: CodewhispererLanguage | ||
| } | ||
| ) { | ||
| if (options?.conversationId === undefined) { | ||
|
|
@@ -351,6 +352,11 @@ | |
| if (metric.codewhispererCustomizationArn) { | ||
| event.customizationArn = metric.codewhispererCustomizationArn | ||
| } | ||
| if (options.programmingLanguage) { | ||
|
Contributor
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. How did we evaluate the programmingLanguage? |
||
| event.programmingLanguage = { | ||
|
Check failure on line 356 in server/aws-lsp-codewhisperer/src/shared/telemetry/telemetryService.ts
|
||
| languageName: getRuntimeLanguage(options.programmingLanguage), | ||
| } | ||
| } | ||
| return this.invokeSendTelemetryEvent({ | ||
| chatInteractWithMessageEvent: event, | ||
| }) | ||
|
|
||
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.
This wont be accurate! as one conversation can have multiple programming languages.