@@ -299,10 +299,11 @@ export class MainThreadAuthentication extends Disposable implements MainThreadAu
299
299
}
300
300
301
301
async $getSession ( providerId : string , scopes : string [ ] , extensionId : string , extensionName : string , options : AuthenticationGetSessionOptions ) : Promise < AuthenticationSession | undefined > {
302
+ this . sendClientIdUsageTelemetry ( extensionId , providerId , scopes ) ;
302
303
const session = await this . doGetSession ( providerId , scopes , extensionId , extensionName , options ) ;
303
304
304
305
if ( session ) {
305
- this . sendProviderUsageTelemetry ( extensionId , providerId , scopes ) ;
306
+ this . sendProviderUsageTelemetry ( extensionId , providerId ) ;
306
307
this . authenticationUsageService . addAccountUsage ( providerId , session . account . label , scopes , extensionId , extensionName ) ;
307
308
}
308
309
@@ -314,18 +315,18 @@ export class MainThreadAuthentication extends Disposable implements MainThreadAu
314
315
return accounts ;
315
316
}
316
317
317
- private sendProviderUsageTelemetry ( extensionId : string , providerId : string , scopes : string [ ] ) : void {
318
- // TODO@TylerLeonhardt this is a temporary addition to telemetry to understand what extensions are overriding the client id.
319
- // We can use this telemetry to reach out to these extension authors and let them know that they many need configuration changes
320
- // due to the adoption of the Microsoft broker.
321
- // Remove this in a few iterations.
318
+ // TODO@TylerLeonhardt this is a temporary addition to telemetry to understand what extensions are overriding the client id.
319
+ // We can use this telemetry to reach out to these extension authors and let them know that they many need configuration changes
320
+ // due to the adoption of the Microsoft broker.
321
+ // Remove this in a few iterations.
322
+ private _sentClientIdUsageEvents = new Set < string > ( ) ;
323
+ private sendClientIdUsageTelemetry ( extensionId : string , providerId : string , scopes : string [ ] ) : void {
322
324
const containsVSCodeClientIdScope = scopes . some ( scope => scope . startsWith ( 'VSCODE_CLIENT_ID:' ) ) ;
323
-
324
325
const key = `${ extensionId } |${ providerId } |${ containsVSCodeClientIdScope } ` ;
325
- if ( this . _sentProviderUsageEvents . has ( key ) ) {
326
+ if ( this . _sentClientIdUsageEvents . has ( key ) ) {
326
327
return ;
327
328
}
328
-
329
+ this . _sentClientIdUsageEvents . add ( key ) ;
329
330
if ( containsVSCodeClientIdScope ) {
330
331
type ClientIdUsageClassification = {
331
332
owner : 'TylerLeonhardt' ;
@@ -334,7 +335,13 @@ export class MainThreadAuthentication extends Disposable implements MainThreadAu
334
335
} ;
335
336
this . telemetryService . publicLog2 < { extensionId : string } , ClientIdUsageClassification > ( 'authentication.clientIdUsage' , { extensionId } ) ;
336
337
}
338
+ }
337
339
340
+ private sendProviderUsageTelemetry ( extensionId : string , providerId : string ) : void {
341
+ const key = `${ extensionId } |${ providerId } ` ;
342
+ if ( this . _sentProviderUsageEvents . has ( key ) ) {
343
+ return ;
344
+ }
338
345
this . _sentProviderUsageEvents . add ( key ) ;
339
346
type AuthProviderUsageClassification = {
340
347
owner : 'TylerLeonhardt' ;
0 commit comments