Skip to content

Commit

Permalink
telemetry: computeEnv reports "wsl" for all remote envs
Browse files Browse the repository at this point in the history
Problem:
1. `computeEnv` reports "wsl" for all remote envs.
2. `computeEnv` does not report "web" envs.

Solution:
1. Only report "wsl" for WSL envs.
2. Report "remote" for other remote envs.
3. Report "web" for unknown web envs.
  • Loading branch information
justinmk3 committed Mar 6, 2025
1 parent da0b811 commit 38ddee9
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions packages/core/src/shared/telemetry/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,33 +257,39 @@ 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'
| 'wsl'
| 'unknown'
| 'remote' // Generic (unknown) remote env.
| 'web' // Generic (unknown) web env.
| 'wsl'

/**
* 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,12 +298,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'
} else {
return 'unknown'
}
Expand Down

0 comments on commit 38ddee9

Please sign in to comment.