public emitAddMessageMetric()

in server/aws-lsp-codewhisperer/src/language-server/chat/telemetry/chatTelemetryController.ts [200:247]


    public emitAddMessageMetric(tabId: string, metric: Partial<CombinedConversationEvent>) {
        const conversationId = this.getConversationId(tabId)
        // Store the customization value associated with the message
        if (metric.cwsprChatMessageId && metric.codewhispererCustomizationArn) {
            this.#customizationInfoByTabAndMessageId[tabId] = {
                ...this.#customizationInfoByTabAndMessageId[tabId],
                [metric.cwsprChatMessageId]: metric.codewhispererCustomizationArn,
            }
        }
        return this.#telemetryService.emitChatAddMessage(
            {
                conversationId: conversationId,
                messageId: metric.cwsprChatMessageId,
                customizationArn: metric.codewhispererCustomizationArn,
                userIntent: metric.cwsprChatUserIntent,
                hasCodeSnippet: metric.cwsprChatHasCodeSnippet,
                programmingLanguage: metric.cwsprChatProgrammingLanguage as CodewhispererLanguage,
                activeEditorTotalCharacters: metric.cwsprChatActiveEditorTotalCharacters,
                timeToFirstChunkMilliseconds: metric.cwsprTimeToFirstChunk,
                timeBetweenChunks: metric.cwsprChatTimeBetweenChunks,
                fullResponselatency: metric.cwsprChatFullResponseLatency,
                requestLength: metric.cwsprChatRequestLength,
                responseLength: metric.cwsprChatResponseLength,
                numberOfCodeBlocks: metric.cwsprChatResponseCodeSnippetCount,
            },
            {
                chatTriggerInteraction: metric.cwsprChatTriggerInteraction,
                chatResponseCode: metric.cwsprChatResponseCode,
                chatSourceLinkCount: metric.cwsprChatSourceLinkCount,
                chatReferencesCount: metric.cwsprChatReferencesCount,
                chatFollowUpCount: metric.cwsprChatFollowUpCount,
                chatConversationType: metric.cwsprChatConversationType,
                chatActiveEditorImportCount: metric.cwsprChatActiveEditorImportCount,
                cwsprChatHasContextList: metric.cwsprChatHasContextList,
                cwsprChatFolderContextCount: metric.cwsprChatFolderContextCount,
                cwsprChatFileContextCount: metric.cwsprChatFileContextCount,
                cwsprChatRuleContextCount: metric.cwsprChatRuleContextCount,
                cwsprChatPromptContextCount: metric.cwsprChatPromptContextCount,
                cwsprChatFileContextLength: metric.cwsprChatFileContextLength,
                cwsprChatRuleContextLength: metric.cwsprChatRuleContextLength,
                cwsprChatPromptContextLength: metric.cwsprChatPromptContextLength,
                cwsprChatCodeContextLength: metric.cwsprChatCodeContextLength,
                cwsprChatCodeContextCount: metric.cwsprChatCodeContextCount,
                cwsprChatFocusFileContextLength: metric.cwsprChatFocusFileContextLength,
                languageServerVersion: metric.languageServerVersion,
            }
        )
    }