@@ -7,13 +7,24 @@ import { Disposable } from 'vs/base/common/lifecycle';
7
7
import { localize } from 'vs/nls' ;
8
8
import { IDialogService } from 'vs/platform/dialogs/common/dialogs' ;
9
9
import { InstantiationType , registerSingleton } from 'vs/platform/instantiation/common/extensions' ;
10
+ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry' ;
10
11
import { DidChangeProfilesEvent , IUserDataProfile , IUserDataProfileOptions , IUserDataProfilesService , IUserDataProfileUpdateOptions , WorkspaceIdentifier } from 'vs/platform/userDataProfile/common/userDataProfile' ;
11
12
import { IWorkspaceContextService , WorkbenchState } from 'vs/platform/workspace/common/workspace' ;
12
13
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService' ;
13
14
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions' ;
14
15
import { IHostService } from 'vs/workbench/services/host/browser/host' ;
15
16
import { DidChangeUserDataProfileEvent , IUserDataProfileManagementService , IUserDataProfileService } from 'vs/workbench/services/userDataProfile/common/userDataProfile' ;
16
17
18
+ export type ProfileManagementActionExecutedClassification = {
19
+ owner : 'sandy081' ;
20
+ comment : 'Logged when profile management action is excuted' ;
21
+ id : { classification : 'SystemMetaData' ; purpose : 'FeatureInsight' ; comment : 'The identifier of the action that was run.' } ;
22
+ } ;
23
+
24
+ export type ProfileManagementActionExecutedEvent = {
25
+ id : string ;
26
+ } ;
27
+
17
28
export class UserDataProfileManagementService extends Disposable implements IUserDataProfileManagementService {
18
29
readonly _serviceBrand : undefined ;
19
30
@@ -25,6 +36,7 @@ export class UserDataProfileManagementService extends Disposable implements IUse
25
36
@IWorkspaceContextService private readonly workspaceContextService : IWorkspaceContextService ,
26
37
@IExtensionService private readonly extensionService : IExtensionService ,
27
38
@IWorkbenchEnvironmentService private readonly environmentService : IWorkbenchEnvironmentService ,
39
+ @ITelemetryService private readonly telemetryService : ITelemetryService ,
28
40
) {
29
41
super ( ) ;
30
42
this . _register ( userDataProfilesService . onDidChangeProfiles ( e => this . onDidChangeProfiles ( e ) ) ) ;
@@ -55,12 +67,14 @@ export class UserDataProfileManagementService extends Disposable implements IUse
55
67
async createAndEnterProfile ( name : string , options ?: IUserDataProfileOptions , fromExisting ?: boolean ) : Promise < IUserDataProfile > {
56
68
const profile = await this . userDataProfilesService . createNamedProfile ( name , options , this . getWorkspaceIdentifier ( ) ) ;
57
69
await this . enterProfile ( profile , ! ! fromExisting ) ;
70
+ this . telemetryService . publicLog2 < ProfileManagementActionExecutedEvent , ProfileManagementActionExecutedClassification > ( 'profileManagementActionExecuted' , { id : 'createAndEnterProfile' } ) ;
58
71
return profile ;
59
72
}
60
73
61
74
async createAndEnterTransientProfile ( ) : Promise < IUserDataProfile > {
62
75
const profile = await this . userDataProfilesService . createTransientProfile ( this . getWorkspaceIdentifier ( ) ) ;
63
76
await this . enterProfile ( profile , false ) ;
77
+ this . telemetryService . publicLog2 < ProfileManagementActionExecutedEvent , ProfileManagementActionExecutedClassification > ( 'profileManagementActionExecuted' , { id : 'createAndEnterTransientProfile' } ) ;
64
78
return profile ;
65
79
}
66
80
@@ -72,6 +86,7 @@ export class UserDataProfileManagementService extends Disposable implements IUse
72
86
throw new Error ( localize ( 'cannotRenameDefaultProfile' , "Cannot rename the default profile" ) ) ;
73
87
}
74
88
await this . userDataProfilesService . updateProfile ( profile , updateOptions ) ;
89
+ this . telemetryService . publicLog2 < ProfileManagementActionExecutedEvent , ProfileManagementActionExecutedClassification > ( 'profileManagementActionExecuted' , { id : 'updateProfile' } ) ;
75
90
}
76
91
77
92
async removeProfile ( profile : IUserDataProfile ) : Promise < void > {
@@ -82,6 +97,7 @@ export class UserDataProfileManagementService extends Disposable implements IUse
82
97
throw new Error ( localize ( 'cannotDeleteDefaultProfile' , "Cannot delete the default profile" ) ) ;
83
98
}
84
99
await this . userDataProfilesService . removeProfile ( profile ) ;
100
+ this . telemetryService . publicLog2 < ProfileManagementActionExecutedEvent , ProfileManagementActionExecutedClassification > ( 'profileManagementActionExecuted' , { id : 'removeProfile' } ) ;
85
101
}
86
102
87
103
async switchProfile ( profile : IUserDataProfile ) : Promise < void > {
@@ -94,6 +110,7 @@ export class UserDataProfileManagementService extends Disposable implements IUse
94
110
}
95
111
await this . userDataProfilesService . setProfileForWorkspace ( workspaceIdentifier , profile ) ;
96
112
await this . enterProfile ( profile , false ) ;
113
+ this . telemetryService . publicLog2 < ProfileManagementActionExecutedEvent , ProfileManagementActionExecutedClassification > ( 'profileManagementActionExecuted' , { id : 'switchProfile' } ) ;
97
114
}
98
115
99
116
private getWorkspaceIdentifier ( ) : WorkspaceIdentifier {
0 commit comments