Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/vs/workbench/contrib/stats/electron-browser/workspaceStats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedPr
import { IWorkspaceStatsService, Tags } from 'vs/workbench/contrib/stats/common/workspaceStats';
import { IWorkspaceInformation } from 'vs/platform/diagnostics/common/diagnostics';
import { IRequestService } from 'vs/platform/request/common/request';
import { isWindows } from 'vs/base/common/platform';

const SshProtocolMatcher = /^([^@:]+@)?([^:]+):/;
const SshUrlMatcher = /^([^@:]+@)?([^:]+):(.+)$/;
Expand Down Expand Up @@ -153,6 +154,8 @@ export class WorkspaceStats implements IWorkbenchContribution {
}

private async report(): Promise<void> {
// Windows-only Edition Event
this.reportWindowsEdition();

// Workspace Stats
this.workspaceStatsService.getTags()
Expand All @@ -167,6 +170,25 @@ export class WorkspaceStats implements IWorkbenchContribution {
this.getWorkspaceInformation().then(stats => diagnosticsChannel.call('reportWorkspaceStats', stats));
}

async reportWindowsEdition(): Promise<void> {
if (!isWindows) {
return;
}

const Registry = await import('vscode-windows-registry');

let value;
try {
value = Registry.GetStringRegKey('HKEY_LOCAL_MACHINE', 'SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion', 'EditionID');
} catch { }

if (value === undefined) {
value = 'Unknown';
}

this.telemetryService.publicLog2<{ edition: string }, { edition: { classification: 'SystemMetaData', purpose: 'BusinessInsight' } }>('windowsEdition', { edition: value });
}

private async getWorkspaceInformation(): Promise<IWorkspaceInformation> {
const workspace = this.contextService.getWorkspace();
const state = this.contextService.getWorkbenchState();
Expand Down