@@ -15,6 +15,8 @@ import { mapMetadata } from './telemetryLogger'
15
15
import { Result } from './telemetry.gen'
16
16
import { MetricDatum } from './clienttelemetry'
17
17
import { isValidationExemptMetric } from './exemptMetrics'
18
+ import { isCloud9 , isSageMaker , isCn } from '../../shared/extensionUtilities'
19
+ import { isInDevEnv } from '../../codecatalyst/utils'
18
20
19
21
const legacySettingsTelemetryValueDisable = 'Disable'
20
22
const legacySettingsTelemetryValueEnable = 'Enable'
@@ -90,6 +92,33 @@ export async function getUserAgent(
90
92
return pairs . join ( ' ' )
91
93
}
92
94
95
+ // Although this is similair to getEnvType() in authUtil files, added new.
96
+ // auth util can be upadate to get ComputeEnv
97
+
98
+ export function getComputeEnvType ( ) {
99
+ // Compute ENV could be one of the following
100
+ // "cloud9"|"cloud9-codecatalyst"|"cloud9-ec2"|"codecatalyst"|"ec2"|"local"|"sagemaker"|"ssh"|"test"|"web"|"wsl"|"other"|string;
101
+
102
+ if ( isCloud9 ( 'classic' ) ) return 'cloud9'
103
+
104
+ if ( isCloud9 ( 'codecatalyst' ) ) return 'cloud9-codecatalyst'
105
+
106
+ if ( isInDevEnv ( ) ) return 'codecatalyst' // should it be codecatalyst devEnv?
107
+
108
+ if ( isCn ( ) ) return 'amazon-cloud9' // name better
109
+
110
+ if ( isSageMaker ( ) ) return 'sagemaker'
111
+
112
+ if ( env . remoteName == 'ssh-remote' && ! isInDevEnv ( ) ) return 'ec2'
113
+
114
+ if ( isAutomation ( ) ) return 'test'
115
+
116
+ if ( ! env . remoteName )
117
+ // use isDevenvVscode instead?
118
+ return 'local'
119
+ else return 'other'
120
+ }
121
+
93
122
/**
94
123
* Validates that emitted telemetry metrics
95
124
* 1. contain a result property and
0 commit comments