Skip to content

Commit 0264176

Browse files
authored
Bulk query marketplace check for missingFromMarketplace (microsoft#250775)
* bulk query marketplace, add telemetry * send telemetry on non-zero missingcount * more useful telemetry * telemetry for queriedIds and missingIds * no need for an extra loop
1 parent 0def0be commit 0264176

File tree

1 file changed

+41
-10
lines changed

1 file changed

+41
-10
lines changed

src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -680,25 +680,56 @@ class Extensions extends Disposable {
680680
}
681681
}
682682
// Detect extensions that do not have a corresponding gallery entry.
683-
// This indicates that it was likely removed from the gallery
684683
if (flagExtensionsMissingFromGallery) {
684+
const extensionsToQuery = [];
685685
for (const extension of this.local) {
686-
if (!extension.identifier.uuid) {
686+
// Extension is already paired with a gallery object
687+
if (extension.gallery) {
687688
continue;
688689
}
689-
if (!flagExtensionsMissingFromGallery.some(f => areSameExtensions(f, extension.identifier))) {
690+
// Already flagged as missing from gallery
691+
if (extension.missingFromGallery) {
690692
continue;
691693
}
692-
if (galleryExtensions.find(g => areSameExtensions(g.identifier, extension.identifier))) {
694+
// A UUID indicates extension originated from gallery
695+
if (!extension.identifier.uuid) {
693696
continue;
694697
}
695-
const [gallery] = await this.galleryService.getExtensions([{ ...extension.identifier, version: extension.version }], CancellationToken.None);
696-
if (gallery) {
697-
extension.gallery = gallery;
698-
} else {
699-
extension.missingFromGallery = true;
698+
// Extension is not present in the set we are concerned about
699+
if (!flagExtensionsMissingFromGallery.some(f => areSameExtensions(f, extension.identifier))) {
700+
continue;
700701
}
701-
this._onChange.fire({ extension });
702+
extensionsToQuery.push(extension);
703+
}
704+
if (extensionsToQuery.length) {
705+
const queryResult = await this.galleryService.getExtensions(extensionsToQuery.map(e => ({ ...e.identifier, version: e.version })), CancellationToken.None);
706+
const queriedIds: string[] = [];
707+
const missingIds: string[] = [];
708+
for (const extension of extensionsToQuery) {
709+
queriedIds.push(extension.identifier.id);
710+
const gallery = queryResult.find(g => areSameExtensions(g.identifier, extension.identifier));
711+
if (gallery) {
712+
extension.gallery = gallery;
713+
} else {
714+
extension.missingFromGallery = true;
715+
missingIds.push(extension.identifier.id);
716+
}
717+
this._onChange.fire({ extension });
718+
}
719+
type MissingFromGalleryClassification = {
720+
owner: 'joshspicer';
721+
comment: 'Report when installed extensions are no longer available in the gallery';
722+
queriedIds: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Extensions queried as potentially missing from gallery' };
723+
missingIds: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Extensions determined missing from gallery' };
724+
};
725+
type MissingFromGalleryEvent = {
726+
readonly queriedIds: TelemetryTrustedValue<string>;
727+
readonly missingIds: TelemetryTrustedValue<string>;
728+
};
729+
this.telemetryService.publicLog2<MissingFromGalleryEvent, MissingFromGalleryClassification>('extensions:missingFromGallery', {
730+
queriedIds: new TelemetryTrustedValue(queriedIds.join(';')),
731+
missingIds: new TelemetryTrustedValue(missingIds.join(';'))
732+
});
702733
}
703734
}
704735
}

0 commit comments

Comments
 (0)