Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

telemetry: computeEnv reports "wsl" for all remote envs #6735

Merged
merged 3 commits into from
Mar 11, 2025
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
27 changes: 17 additions & 10 deletions packages/core/src/shared/telemetry/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,33 +257,38 @@ export function getUserAgent(
}

/**
* All the types of ENVs the extension can run in.
* Kinds of machines/environments the extension can run in.
*
* NOTES:
* - append `-amzn` for any environment internal to Amazon
* - Append `-amzn` for any environment internal to Amazon.
* - Append `-web` for web browser (*without* compute).
*/
export type EnvType =
| 'cloud9'
| 'cloud9-web'
| 'cloudDesktop-amzn'
| 'codecatalyst'
| 'local'
| 'ec2'
| 'ec2-amzn' // ec2 but with an internal Amazon OS
| 'local'
| 'sagemaker'
| 'sagemaker-web'
| 'test'
| 'remote' // Generic (unknown) remote env.
| 'web' // Generic (unknown) web env.
| 'wsl'
| 'unknown'

/**
* Returns the identifier for the environment that the extension is running in.
*/
export async function getComputeEnvType(): Promise<EnvType> {
const web = isWeb()
if (isCloud9()) {
return 'cloud9'
return web ? 'cloud9-web' : 'cloud9'
} else if (isInDevEnv()) {
return 'codecatalyst'
} else if (isSageMaker()) {
return 'sagemaker'
return web ? 'sagemaker-web' : 'sagemaker'
} else if (isRemoteWorkspace()) {
if (isAmazonInternalOs()) {
if (await isCloudDesktop()) {
Expand All @@ -292,14 +297,16 @@ export async function getComputeEnvType(): Promise<EnvType> {
return 'ec2-amzn'
}
return 'ec2'
} else if (env.remoteName) {
} else if (env.remoteName === 'wsl') {
return 'wsl'
} else if (isAutomation()) {
return 'test'
} else if (!env.remoteName) {
return 'local'
} else if (web) {
return 'web'
} else if (env.remoteName) {
return 'remote' // Generic (unknown) remote env.
} else {
return 'unknown'
return 'local' // Generic (unknown) local env.
}
}

Expand Down
Loading