提交 c47cdcfe 编写于 作者: J Johannes Rieken

send telemetry message when extensions generate warning during real world run, #27090

上级 8deb8efc
......@@ -32,6 +32,8 @@ export interface IMessage {
type: Severity;
message: string;
source: string;
extensionId: string;
extensionPointId: string;
}
export interface IExtensionsStatus {
......
......@@ -17,19 +17,27 @@ const schemaRegistry = <IJSONContributionRegistry>Registry.as(Extensions.JSONCon
export class ExtensionMessageCollector {
private _messageHandler: (msg: IMessage) => void;
private _source: string;
constructor(messageHandler: (msg: IMessage) => void, source: string) {
private readonly _messageHandler: (msg: IMessage) => void;
private readonly _extension: IExtensionDescription;
private readonly _extensionPointId: string;
constructor(
messageHandler: (msg: IMessage) => void,
extension: IExtensionDescription,
extensionPointId: string
) {
this._messageHandler = messageHandler;
this._source = source;
this._extension = extension;
this._extensionPointId = extensionPointId;
}
private _msg(type: Severity, message: string): void {
this._messageHandler({
type: type,
message: message,
source: this._source
source: this._extension.extensionFolderPath,
extensionId: this._extension.id,
extensionPointId: this._extensionPointId
});
}
......
......@@ -51,8 +51,6 @@ const hasOwnProperty = Object.hasOwnProperty;
export class MainProcessExtensionService extends AbstractExtensionService<ActivatedExtension> {
private _threadService: IThreadService;
private _messageService: IMessageService;
private _proxy: ExtHostExtensionServiceShape;
private _isDev: boolean;
private _extensionsStatus: { [id: string]: IExtensionsStatus };
......@@ -61,17 +59,15 @@ export class MainProcessExtensionService extends AbstractExtensionService<Activa
* This class is constructed manually because it is a service, so it doesn't use any ctor injection
*/
constructor(
@IThreadService threadService: IThreadService,
@IMessageService messageService: IMessageService,
@IThreadService private readonly _threadService: IThreadService,
@IMessageService private readonly _messageService: IMessageService,
@IEnvironmentService private readonly environmentService: IEnvironmentService,
@ITelemetryService private readonly _telemetryService: ITelemetryService,
@IExtensionEnablementService extensionEnablementService: IExtensionEnablementService,
@ITelemetryService telemetryService: ITelemetryService,
@IEnvironmentService private environmentService: IEnvironmentService,
) {
super(false);
this._isDev = !environmentService.isBuilt || environmentService.isExtensionDevelopment;
this._messageService = messageService;
this._threadService = threadService;
this._proxy = this._threadService.get(ExtHostContext.ExtHostExtensionService);
this._extensionsStatus = {};
......@@ -82,7 +78,7 @@ export class MainProcessExtensionService extends AbstractExtensionService<Activa
this.scanExtensions().done(extensionDescriptions => {
telemetryService.publicLog('extensionsScanned', {
_telemetryService.publicLog('extensionsScanned', {
totalCount: extensionDescriptions.length,
disabledCount: disabledExtensions.length
});
......@@ -98,6 +94,13 @@ export class MainProcessExtensionService extends AbstractExtensionService<Activa
this._extensionsStatus[msg.source] = { messages: [] };
}
this._extensionsStatus[msg.source].messages.push(msg);
if (!this._isDev && msg.extensionId) {
const { type, extensionId, extensionPointId, message } = msg;
this._telemetryService.publicLog('extensionsMessage', {
type, extensionId, extensionPointId, message
});
}
}
public $localShowMessage(severity: Severity, msg: string): void {
......@@ -175,7 +178,7 @@ export class MainProcessExtensionService extends AbstractExtensionService<Activa
users[usersLen++] = {
description: desc,
value: desc.contributes[extensionPoint.name],
collector: new ExtensionMessageCollector(messageHandler, desc.extensionFolderPath)
collector: new ExtensionMessageCollector(messageHandler, desc, extensionPoint.name)
};
}
}
......
......@@ -48,7 +48,9 @@ export class MessagesCollector {
this._messages.push({
type: type,
message: message,
source: source
source: source,
extensionId: undefined,
extensionPointId: undefined
});
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册