parent
231bad3fbb
commit
8aa430710a
3 changed files with 37 additions and 16 deletions
|
@ -0,0 +1,30 @@
|
||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
import { ILocalExtension, IGalleryExtension } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||||
|
|
||||||
|
export function getLocalExtensionTelemetryData(extension: ILocalExtension): any {
|
||||||
|
return {
|
||||||
|
id: `${ extension.manifest.publisher }.${ extension.manifest.name }`,
|
||||||
|
name: extension.manifest.name,
|
||||||
|
galleryId: extension.metadata ? extension.metadata.id : null,
|
||||||
|
publisherId: extension.metadata ? extension.metadata.publisherId : null,
|
||||||
|
publisherName: extension.manifest.publisher,
|
||||||
|
publisherDisplayName: extension.metadata ? extension.metadata.publisherDisplayName : null
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getGalleryExtensionTelemetryData(extension: IGalleryExtension): any {
|
||||||
|
return {
|
||||||
|
id: `${ extension.publisher }.${ extension.name }`,
|
||||||
|
name: extension.name,
|
||||||
|
galleryId: extension.id,
|
||||||
|
publisherId: extension.publisherId,
|
||||||
|
publisherName: extension.publisher,
|
||||||
|
publisherDisplayName: extension.publisherDisplayName
|
||||||
|
};
|
||||||
|
}
|
|
@ -8,6 +8,7 @@ import { tmpdir } from 'os';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import { TPromise } from 'vs/base/common/winjs.base';
|
import { TPromise } from 'vs/base/common/winjs.base';
|
||||||
import { IGalleryExtension, IExtensionGalleryService, IQueryOptions, SortBy, SortOrder, IExtensionManifest } from 'vs/platform/extensionManagement/common/extensionManagement';
|
import { IGalleryExtension, IExtensionGalleryService, IQueryOptions, SortBy, SortOrder, IExtensionManifest } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||||
|
import { getGalleryExtensionTelemetryData } from 'vs/platform/extensionManagement/common/extensionTelemetry';
|
||||||
import { isUndefined } from 'vs/base/common/types';
|
import { isUndefined } from 'vs/base/common/types';
|
||||||
import { assign, getOrDefault } from 'vs/base/common/objects';
|
import { assign, getOrDefault } from 'vs/base/common/objects';
|
||||||
import { IRequestService } from 'vs/platform/request/common/request';
|
import { IRequestService } from 'vs/platform/request/common/request';
|
||||||
|
@ -339,10 +340,13 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
|
||||||
return this.getLastValidExtensionVersion(rawExtension, rawExtension.versions).then(rawVersion => {
|
return this.getLastValidExtensionVersion(rawExtension, rawExtension.versions).then(rawVersion => {
|
||||||
const url = `${ getAssetSource(rawVersion.files, AssetType.VSIX) }?install=true`;
|
const url = `${ getAssetSource(rawVersion.files, AssetType.VSIX) }?install=true`;
|
||||||
const zipPath = path.join(tmpdir(), extension.id);
|
const zipPath = path.join(tmpdir(), extension.id);
|
||||||
|
const data = getGalleryExtensionTelemetryData(extension);
|
||||||
|
const timer = this.telemetryService.timedPublicLog('galleryService:downloadVSIX', data);
|
||||||
|
|
||||||
return this.getCommonHeaders()
|
return this.getCommonHeaders()
|
||||||
.then(headers => this._getAsset({ url, headers }))
|
.then(headers => this._getAsset({ url, headers }))
|
||||||
.then(context => download(zipPath, context))
|
.then(context => download(zipPath, context))
|
||||||
|
.then(() => timer.stop())
|
||||||
.then(() => zipPath);
|
.then(() => zipPath);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -15,6 +15,7 @@ import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||||
import { IPager, mapPager, singlePagePager } from 'vs/base/common/paging';
|
import { IPager, mapPager, singlePagePager } from 'vs/base/common/paging';
|
||||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||||
import { IExtensionManagementService, IExtensionGalleryService, IExtensionTipsService, ILocalExtension, IGalleryExtension, IQueryOptions } from 'vs/platform/extensionManagement/common/extensionManagement';
|
import { IExtensionManagementService, IExtensionGalleryService, IExtensionTipsService, ILocalExtension, IGalleryExtension, IQueryOptions } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||||
|
import { getGalleryExtensionTelemetryData, getLocalExtensionTelemetryData } from 'vs/platform/extensionManagement/common/extensionTelemetry';
|
||||||
import * as semver from 'semver';
|
import * as semver from 'semver';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import URI from 'vs/base/common/uri';
|
import URI from 'vs/base/common/uri';
|
||||||
|
@ -120,23 +121,9 @@ class Extension implements IExtension {
|
||||||
const { local, gallery } = this;
|
const { local, gallery } = this;
|
||||||
|
|
||||||
if (gallery) {
|
if (gallery) {
|
||||||
return {
|
return getGalleryExtensionTelemetryData(gallery);
|
||||||
id: `${ gallery.publisher }.${ gallery.name }`,
|
|
||||||
name: gallery.name,
|
|
||||||
galleryId: gallery.id,
|
|
||||||
publisherId: gallery.publisherId,
|
|
||||||
publisherName: gallery.publisher,
|
|
||||||
publisherDisplayName: gallery.publisherDisplayName
|
|
||||||
};
|
|
||||||
} else {
|
} else {
|
||||||
return {
|
return getLocalExtensionTelemetryData(local);
|
||||||
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
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue