Skip to content

Commit cec7120

Browse files
authored
telemetry: computeEnv reports "wsl" for all remote envs (aws#6735)
## 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. --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 2c0b4a5 commit cec7120

File tree

1 file changed

+17
-10
lines changed
  • packages/core/src/shared/telemetry

1 file changed

+17
-10
lines changed

packages/core/src/shared/telemetry/util.ts

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -257,33 +257,38 @@ export function getUserAgent(
257257
}
258258

259259
/**
260-
* All the types of ENVs the extension can run in.
260+
* Kinds of machines/environments the extension can run in.
261261
*
262262
* NOTES:
263-
* - append `-amzn` for any environment internal to Amazon
263+
* - Append `-amzn` for any environment internal to Amazon.
264+
* - Append `-web` for web browser (*without* compute).
264265
*/
265266
export type EnvType =
266267
| 'cloud9'
268+
| 'cloud9-web'
267269
| 'cloudDesktop-amzn'
268270
| 'codecatalyst'
269-
| 'local'
270271
| 'ec2'
271272
| 'ec2-amzn' // ec2 but with an internal Amazon OS
273+
| 'local'
272274
| 'sagemaker'
275+
| 'sagemaker-web'
273276
| 'test'
277+
| 'remote' // Generic (unknown) remote env.
278+
| 'web' // Generic (unknown) web env.
274279
| 'wsl'
275-
| 'unknown'
276280

277281
/**
278282
* Returns the identifier for the environment that the extension is running in.
279283
*/
280284
export async function getComputeEnvType(): Promise<EnvType> {
285+
const web = isWeb()
281286
if (isCloud9()) {
282-
return 'cloud9'
287+
return web ? 'cloud9-web' : 'cloud9'
283288
} else if (isInDevEnv()) {
284289
return 'codecatalyst'
285290
} else if (isSageMaker()) {
286-
return 'sagemaker'
291+
return web ? 'sagemaker-web' : 'sagemaker'
287292
} else if (isRemoteWorkspace()) {
288293
if (isAmazonInternalOs()) {
289294
if (await isCloudDesktop()) {
@@ -292,14 +297,16 @@ export async function getComputeEnvType(): Promise<EnvType> {
292297
return 'ec2-amzn'
293298
}
294299
return 'ec2'
295-
} else if (env.remoteName) {
300+
} else if (env.remoteName === 'wsl') {
296301
return 'wsl'
297302
} else if (isAutomation()) {
298303
return 'test'
299-
} else if (!env.remoteName) {
300-
return 'local'
304+
} else if (web) {
305+
return 'web'
306+
} else if (env.remoteName) {
307+
return 'remote' // Generic (unknown) remote env.
301308
} else {
302-
return 'unknown'
309+
return 'local' // Generic (unknown) local env.
303310
}
304311
}
305312

0 commit comments

Comments
 (0)