Skip to content

Commit ef56385

Browse files
committed
add credentialType to iam telemetry metadata and fix emitIamClick
1 parent dfcc0b0 commit ef56385

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

packages/core/src/login/webview/vue/amazonq/backend_amazonq.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { builderIdStartUrl } from '../../../../auth/sso/constants'
2020
import { RegionProfile, vsCodeState } from '../../../../codewhisperer/models/model'
2121
import { randomUUID } from '../../../../shared/crypto'
2222
import globals from '../../../../shared/extensionGlobals'
23-
import { telemetry } from '../../../../shared/telemetry/telemetry'
23+
import { CredentialType, telemetry } from '../../../../shared/telemetry/telemetry'
2424
import { ProfileSwitchIntent } from '../../../../codewhisperer/region/regionProfileManager'
2525

2626
const className = 'AmazonQLoginWebview'
@@ -204,6 +204,15 @@ export class AmazonQLoginWebview extends CommonAuthWebview {
204204
// Defining separate auth function to emit telemetry before returning from this method
205205
await globals.globalState.update('recentIamKeys', { accessKey: accessKey })
206206
await globals.globalState.update('recentRoleArn', { roleArn: roleArn })
207+
let credentialsType: CredentialType | undefined
208+
if (!sessionToken && !roleArn) {
209+
credentialsType = 'staticProfile'
210+
} else if (roleArn) {
211+
credentialsType = 'assumeRoleProfile'
212+
} else {
213+
credentialsType = 'staticSessionProfile'
214+
}
215+
207216
const runAuth = async (): Promise<AuthError | undefined> => {
208217
try {
209218
await AuthUtil.instance.login_iam(accessKey, secretKey, sessionToken, roleArn)
@@ -225,6 +234,7 @@ export class AmazonQLoginWebview extends CommonAuthWebview {
225234
this.storeMetricMetadata({
226235
credentialSourceId: 'sharedCredentials',
227236
authEnabledFeatures: 'codewhisperer',
237+
credentialType: credentialsType,
228238
...this.getResultForMetrics(result),
229239
})
230240
this.emitAuthMetric()

packages/core/src/login/webview/vue/backend.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,8 @@ export abstract class CommonAuthWebview extends VueWebview {
232232
}
233233

234234
emitIamClick() {
235-
telemetry.auth_signInOptionClick.emit({
236-
signInOption: 'IAM Credentials',
235+
telemetry.ui_click.emit({
236+
elementId: 'Use with IAM Credentials',
237237
})
238238
}
239239

0 commit comments

Comments
 (0)