extensionGallery:openExtension telemetry event

fixes #10606
This commit is contained in:
Joao Moreno 2016-08-17 10:00:13 +02:00
parent f80496d396
commit 72030e1873
3 changed files with 27 additions and 28 deletions

View file

@ -125,6 +125,7 @@ export class ExtensionEditor extends BaseEditor {
this.transientDisposables = dispose(this.transientDisposables);
const extension = input.extension;
this.telemetryService.publicLog('extensionGallery:openExtension', extension.telemetryData);
this.icon.style.backgroundImage = `url("${ extension.iconUrl }")`;
this.name.textContent = extension.displayName;

View file

@ -39,6 +39,7 @@ export interface IExtension {
rating: number;
ratingCount: number;
outdated: boolean;
telemetryData: any;
}
export const SERVICE_ID = 'extensionsWorkbenchService';

View file

@ -113,6 +113,30 @@ class Extension implements IExtension {
get outdated(): boolean {
return semver.gt(this.latestVersion, this.version);
}
get telemetryData(): any {
const { local, gallery } = this;
if (gallery) {
return {
id: `${ gallery.publisher }.${ gallery.name }`,
name: gallery.name,
galleryId: gallery.id,
publisherId: gallery.publisherId,
publisherName: gallery.publisher,
publisherDisplayName: gallery.publisherDisplayName
};
} else {
return {
id: `${ local.manifest.publisher }.${ local.manifest.name }`,
name: local.manifest.name,
galleryId: local.metadata ? local.metadata.id : null,
publisherId: local.metadata ? local.metadata.publisherId : null,
publisherName: local.manifest.publisher,
publisherDisplayName: local.metadata ? local.metadata.publisherDisplayName : null
};
}
}
}
function stripVersion(id: string): string {
@ -384,34 +408,7 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService {
}
private reportTelemetry(active: IActiveExtension, success: boolean): void {
if (!active.extension) {
return;
}
const local = active.extension.local;
const gallery = active.extension.gallery;
let data = null;
if (gallery) {
data = {
id: `${ gallery.publisher }.${ gallery.name }`,
name: gallery.name,
galleryId: gallery.id,
publisherId: gallery.publisherId,
publisherName: gallery.publisher,
publisherDisplayName: gallery.publisherDisplayName
};
} else {
data = {
id: `${ local.manifest.publisher }.${ local.manifest.name }`,
name: local.manifest.name,
galleryId: local.metadata ? local.metadata.id : null,
publisherId: local.metadata ? local.metadata.publisherId : null,
publisherName: local.manifest.publisher,
publisherDisplayName: local.metadata ? local.metadata.publisherDisplayName : null
};
}
const data = active.extension.telemetryData;
const duration = new Date().getTime() - active.start.getTime();
const eventName = toTelemetryEventName(active.operation);