@@ -15,6 +15,7 @@ import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
1515import { Event , Emitter } from 'vs/base/common/event' ;
1616import { firstIndex } from 'vs/base/common/arrays' ;
1717import { IStorageKeysSyncRegistryService } from 'vs/platform/userDataSync/common/storageKeys' ;
18+ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry' ;
1819
1920class CounterSet < T > implements IReadableSet < T > {
2021
@@ -219,7 +220,8 @@ export class ViewDescriptorService extends Disposable implements IViewDescriptor
219220 @IContextKeyService private readonly contextKeyService : IContextKeyService ,
220221 @IStorageService private readonly storageService : IStorageService ,
221222 @IExtensionService private readonly extensionService : IExtensionService ,
222- @IStorageKeysSyncRegistryService storageKeysSyncRegistryService : IStorageKeysSyncRegistryService
223+ @ITelemetryService private readonly telemetryService : ITelemetryService ,
224+ @IStorageKeysSyncRegistryService storageKeysSyncRegistryService : IStorageKeysSyncRegistryService ,
223225 ) {
224226 super ( ) ;
225227
@@ -452,6 +454,43 @@ export class ViewDescriptorService extends Disposable implements IViewDescriptor
452454
453455 if ( ! skipCacheUpdate ) {
454456 this . saveViewPositionsToCache ( ) ;
457+
458+ const containerToString = ( container : ViewContainer ) : string => {
459+ if ( container . id . startsWith ( ViewDescriptorService . COMMON_CONTAINER_ID_PREFIX ) ) {
460+ return 'custom' ;
461+ }
462+
463+ if ( ! container . extensionId ) {
464+ return container . id ;
465+ }
466+
467+ return 'extension' ;
468+ } ;
469+
470+ // Log on cache update to avoid duplicate events in other windows
471+ const viewCount = views . length ;
472+ const fromContainer = containerToString ( from ) ;
473+ const toContainer = containerToString ( to ) ;
474+ const fromLocation = oldLocation === ViewContainerLocation . Panel ? 'panel' : 'sidebar' ;
475+ const toLocation = newLocation === ViewContainerLocation . Panel ? 'panel' : 'sidebar' ;
476+
477+ interface ViewDescriptorServiceMoveViewsEvent {
478+ viewCount : number ;
479+ fromContainer : string ;
480+ toContainer : string ;
481+ fromLocation : string ;
482+ toLocation : string ;
483+ }
484+
485+ type ViewDescriptorServiceMoveViewsClassification = {
486+ viewCount : { classification : 'SystemMetaData' , purpose : 'FeatureInsight' } ;
487+ fromContainer : { classification : 'SystemMetaData' , purpose : 'FeatureInsight' } ;
488+ toContainer : { classification : 'SystemMetaData' , purpose : 'FeatureInsight' } ;
489+ fromLocation : { classification : 'SystemMetaData' , purpose : 'FeatureInsight' } ;
490+ toLocation : { classification : 'SystemMetaData' , purpose : 'FeatureInsight' } ;
491+ } ;
492+
493+ this . telemetryService . publicLog2 < ViewDescriptorServiceMoveViewsEvent , ViewDescriptorServiceMoveViewsClassification > ( 'viewDescriptorService.moveViews' , { viewCount, fromContainer, toContainer, fromLocation, toLocation } ) ;
455494 }
456495 }
457496
0 commit comments