Skip to content

Commit 0e48dd9

Browse files
committed
send telemetry when keytar shim is handed out to extensions, #115215
1 parent 1b36433 commit 0e48dd9

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/vs/workbench/api/common/extHostRequireInterceptor.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export abstract class RequireInterceptor {
5959
const extensionPaths = await this._extHostExtensionService.getExtensionPathIndex();
6060

6161
this.register(new VSCodeNodeModuleFactory(this._apiFactory, extensionPaths, this._extensionRegistry, configProvider, this._logService));
62-
this.register(this._instaService.createInstance(KeytarNodeModuleFactory));
62+
this.register(this._instaService.createInstance(KeytarNodeModuleFactory, extensionPaths));
6363
if (this._initData.remote.isRemote) {
6464
this.register(this._instaService.createInstance(OpenNodeModuleFactory, extensionPaths, this._initData.environment.appUriScheme));
6565
}
@@ -140,14 +140,17 @@ interface IKeytarModule {
140140
class KeytarNodeModuleFactory implements INodeModuleFactory {
141141
public readonly nodeModuleName: string = 'keytar';
142142

143+
private readonly _mainThreadTelemetry: MainThreadTelemetryShape;
143144
private alternativeNames: Set<string> | undefined;
144145
private _impl: IKeytarModule;
145146

146147
constructor(
148+
private readonly _extensionPaths: TernarySearchTree<URI, IExtensionDescription>,
147149
@IExtHostRpcService rpcService: IExtHostRpcService,
148150
@IExtHostInitDataService initData: IExtHostInitDataService,
149151

150152
) {
153+
this._mainThreadTelemetry = rpcService.getProxy(MainContext.MainThreadTelemetry);
151154
const { environment } = initData;
152155
const mainThreadKeytar = rpcService.getProxy(MainContext.MainThreadKeytar);
153156

@@ -182,7 +185,12 @@ class KeytarNodeModuleFactory implements INodeModuleFactory {
182185
};
183186
}
184187

185-
public load(_request: string, _parent: URI): any {
188+
public load(_request: string, parent: URI): any {
189+
const ext = this._extensionPaths.findSubstr(parent);
190+
type ShimmingKeytarClassification = {
191+
extension: { classification: 'SystemMetaData', purpose: 'FeatureInsight' };
192+
};
193+
this._mainThreadTelemetry.$publicLog2<{ extension: string }, ShimmingKeytarClassification>('shimming.keytar', { extension: ext?.identifier.value ?? 'unknown_extension' });
186194
return this._impl;
187195
}
188196

0 commit comments

Comments
 (0)