Skip to content

Commit 6579aa2

Browse files
authored
chore: adding logs for telemetry events (#2015)
1 parent 6f981a2 commit 6579aa2

File tree

1 file changed

+35
-15
lines changed

1 file changed

+35
-15
lines changed

server/aws-lsp-codewhisperer/src/shared/telemetry/telemetryService.ts

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
InlineChatEvent,
2222
AgenticChatEventStatus,
2323
IdeDiagnostic,
24+
UserModificationEvent,
2425
} from '../../client/token/codewhispererbearertokenclient'
2526
import { getCompletionType, getSsoConnectionType, isAwsError } from '../utils'
2627
import {
@@ -275,6 +276,12 @@ export class TelemetryService {
275276
removedIdeDiagnostics: removedIdeDiagnostics,
276277
streakLength: streakLength ?? 0,
277278
}
279+
this.logging.info(`Invoking SendTelemetryEvent:UserTriggerDecisionEvent with:
280+
"suggestionState": ${event.suggestionState}
281+
"acceptedCharacterCount": ${event.acceptedCharacterCount}
282+
"addedCharacterCount": ${event.addedCharacterCount}
283+
"deletedCharacterCount": ${event.deletedCharacterCount}
284+
"streakLength": ${event.streakLength}`)
278285
return this.invokeSendTelemetryEvent({
279286
userTriggerDecisionEvent: event,
280287
})
@@ -383,22 +390,30 @@ export class TelemetryService {
383390
})
384391
}
385392

386-
return this.invokeSendTelemetryEvent({
387-
userModificationEvent: {
388-
sessionId: params.sessionId,
389-
requestId: params.requestId,
390-
programmingLanguage: {
391-
languageName: getRuntimeLanguage(params.languageId),
392-
},
393-
// deprecated % value and should not be used by service side
394-
modificationPercentage: params.modificationPercentage,
395-
customizationArn: params.customizationArn,
396-
timestamp: params.timestamp,
397-
acceptedCharacterCount: params.acceptedCharacterCount,
398-
unmodifiedAcceptedCharacterCount: params.unmodifiedAcceptedCharacterCount,
399-
addedCharacterCount: params.acceptedCharacterCount,
400-
unmodifiedAddedCharacterCount: params.unmodifiedAcceptedCharacterCount,
393+
const event: UserModificationEvent = {
394+
sessionId: params.sessionId,
395+
requestId: params.requestId,
396+
programmingLanguage: {
397+
languageName: getRuntimeLanguage(params.languageId),
401398
},
399+
// deprecated % value and should not be used by service side
400+
modificationPercentage: params.modificationPercentage,
401+
customizationArn: params.customizationArn,
402+
timestamp: params.timestamp,
403+
acceptedCharacterCount: params.acceptedCharacterCount,
404+
unmodifiedAcceptedCharacterCount: params.unmodifiedAcceptedCharacterCount,
405+
addedCharacterCount: params.acceptedCharacterCount,
406+
unmodifiedAddedCharacterCount: params.unmodifiedAcceptedCharacterCount,
407+
}
408+
409+
this.logging.info(`Invoking SendTelemetryEvent:UserModificationEvent with:
410+
"acceptedCharacterCount": ${event.acceptedCharacterCount}
411+
"unmodifiedAcceptedCharacterCount": ${event.unmodifiedAcceptedCharacterCount}
412+
"addedCharacterCount": ${event.addedCharacterCount}
413+
"unmodifiedAddedCharacterCount": ${event.unmodifiedAddedCharacterCount}`)
414+
415+
return this.invokeSendTelemetryEvent({
416+
userModificationEvent: event,
402417
})
403418
}
404419

@@ -444,6 +459,11 @@ export class TelemetryService {
444459
}
445460
if (params.customizationArn) event.customizationArn = params.customizationArn
446461

462+
this.logging.info(`Invoking SendTelemetryEvent:CodeCoverageEvent with:
463+
"acceptedCharacterCount": ${event.acceptedCharacterCount}
464+
"totalCharacterCount": ${event.totalCharacterCount}
465+
"addedCharacterCount": ${event.addedCharacterCount}`)
466+
447467
return this.invokeSendTelemetryEvent({
448468
codeCoverageEvent: event,
449469
})

0 commit comments

Comments
 (0)