Skip to content

Commit

Permalink
report new window profile switch (#213566)
Browse files Browse the repository at this point in the history
  • Loading branch information
sandy081 authored May 27, 2024
1 parent 1e2258a commit 014beb7
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { INotificationService } from 'vs/platform/notification/common/notificati
import { IFileDialogService } from 'vs/platform/dialogs/common/dialogs';
import { URI } from 'vs/base/common/uri';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
import { IWorkspaceTagsService } from 'vs/workbench/contrib/tags/common/workspaceTags';
import { getErrorMessage } from 'vs/base/common/errors';
import { Categories } from 'vs/platform/action/common/actionCommonCategories';
Expand All @@ -40,6 +40,7 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements
private readonly currentProfileContext: IContextKey<string>;
private readonly isCurrentProfileTransientContext: IContextKey<boolean>;
private readonly hasProfilesContext: IContextKey<boolean>;
private readonly startTime: number = Date.now();

constructor(
@IUserDataProfileService private readonly userDataProfileService: IUserDataProfileService,
Expand Down Expand Up @@ -206,6 +207,19 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements
}
async run(accessor: ServicesAccessor) {
if (that.userDataProfileService.currentProfile.id !== profile.id) {
if (profile.isDefault && Date.now() - that.startTime < (1000 * 20 /* 20 seconds */)) {
type SwitchToDefaultProfileInfoClassification = {
owner: 'sandy081';
comment: 'Report if the user switches to the default profile.';
emptyWindow: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'If the current window is empty window or not' };
};
type SwitchToDefaultProfileInfoEvent = {
emptyWindow: boolean;
};
that.telemetryService.publicLog2<SwitchToDefaultProfileInfoEvent, SwitchToDefaultProfileInfoClassification>('profiles:newwindowprofile', {
emptyWindow: that.workspaceContextService.getWorkbenchState() === WorkbenchState.EMPTY
});
}
return that.userDataProfileManagementService.switchProfile(profile);
}
}
Expand Down

0 comments on commit 014beb7

Please sign in to comment.