send telemetry when keytar shim is handed out to extensions, https://github.com/microsoft/vscode/issues/115215

This commit is contained in:
Johannes Rieken
2021-10-19 16:23:18 +02:00
parent 1b364332c4
commit 0e48dd9af2

View File

@@ -59,7 +59,7 @@ export abstract class RequireInterceptor {
const extensionPaths = await this._extHostExtensionService.getExtensionPathIndex();
this.register(new VSCodeNodeModuleFactory(this._apiFactory, extensionPaths, this._extensionRegistry, configProvider, this._logService));
this.register(this._instaService.createInstance(KeytarNodeModuleFactory));
this.register(this._instaService.createInstance(KeytarNodeModuleFactory, extensionPaths));
if (this._initData.remote.isRemote) {
this.register(this._instaService.createInstance(OpenNodeModuleFactory, extensionPaths, this._initData.environment.appUriScheme));
}
@@ -140,14 +140,17 @@ interface IKeytarModule {
class KeytarNodeModuleFactory implements INodeModuleFactory {
public readonly nodeModuleName: string = 'keytar';
private readonly _mainThreadTelemetry: MainThreadTelemetryShape;
private alternativeNames: Set<string> | undefined;
private _impl: IKeytarModule;
constructor(
private readonly _extensionPaths: TernarySearchTree<URI, IExtensionDescription>,
@IExtHostRpcService rpcService: IExtHostRpcService,
@IExtHostInitDataService initData: IExtHostInitDataService,
) {
this._mainThreadTelemetry = rpcService.getProxy(MainContext.MainThreadTelemetry);
const { environment } = initData;
const mainThreadKeytar = rpcService.getProxy(MainContext.MainThreadKeytar);
@@ -182,7 +185,12 @@ class KeytarNodeModuleFactory implements INodeModuleFactory {
};
}
public load(_request: string, _parent: URI): any {
public load(_request: string, parent: URI): any {
const ext = this._extensionPaths.findSubstr(parent);
type ShimmingKeytarClassification = {
extension: { classification: 'SystemMetaData', purpose: 'FeatureInsight' };
};
this._mainThreadTelemetry.$publicLog2<{ extension: string }, ShimmingKeytarClassification>('shimming.keytar', { extension: ext?.identifier.value ?? 'unknown_extension' });
return this._impl;
}