@@ -36,7 +36,7 @@ const SecondLevelDomainWhitelist = [
3636 'google.com'
3737] ;
3838
39- type Tags = { [ index : string ] : boolean | number } ;
39+ type Tags = { [ index : string ] : boolean | number | string } ;
4040
4141function stripLowLevelDomains ( domain : string ) : string {
4242 let match = domain . match ( SecondLevelDomainMatcher ) ;
@@ -149,6 +149,7 @@ export class WorkspaceStats {
149149 "workbench.filesToOpen" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
150150 "workbench.filesToCreate" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
151151 "workbench.filesToDiff" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
152+ "workspace.id" : { "classification": "CustomerContent", "purpose": "FeatureInsight" },
152153 "workspace.roots" : { "classification": "CustomerContent", "purpose": "FeatureInsight" },
153154 "workspace.empty" : { "classification": "CustomerContent", "purpose": "FeatureInsight" },
154155 "workspace.grunt" : { "classification": "CustomerContent", "purpose": "FeatureInsight" },
@@ -175,13 +176,29 @@ export class WorkspaceStats {
175176 private getWorkspaceTags ( configuration : IWindowConfiguration ) : TPromise < Tags > {
176177 const tags : Tags = Object . create ( null ) ;
177178
179+ const state = this . contextService . getWorkbenchState ( ) ;
180+ const workspace = this . contextService . getWorkspace ( ) ;
181+
182+ let workspaceId : string ;
183+ switch ( state ) {
184+ case WorkbenchState . EMPTY :
185+ workspaceId = void 0 ;
186+ break ;
187+ case WorkbenchState . FOLDER :
188+ workspaceId = crypto . createHash ( 'sha1' ) . update ( workspace . folders [ 0 ] . uri . fsPath ) . digest ( 'hex' ) ;
189+ break ;
190+ case WorkbenchState . WORKSPACE :
191+ workspaceId = crypto . createHash ( 'sha1' ) . update ( workspace . configuration . fsPath ) . digest ( 'hex' ) ;
192+ }
193+
194+ tags [ 'workspace.id' ] = workspaceId ;
195+
178196 const { filesToOpen, filesToCreate, filesToDiff } = configuration ;
179197 tags [ 'workbench.filesToOpen' ] = filesToOpen && filesToOpen . length || 0 ;
180198 tags [ 'workbench.filesToCreate' ] = filesToCreate && filesToCreate . length || 0 ;
181199 tags [ 'workbench.filesToDiff' ] = filesToDiff && filesToDiff . length || 0 ;
182200
183- const isEmpty = this . contextService . getWorkbenchState ( ) === WorkbenchState . EMPTY ;
184- const workspace = this . contextService . getWorkspace ( ) ;
201+ const isEmpty = state === WorkbenchState . EMPTY ;
185202 tags [ 'workspace.roots' ] = isEmpty ? 0 : workspace . folders . length ;
186203 tags [ 'workspace.empty' ] = isEmpty ;
187204
0 commit comments