@@ -15,7 +15,7 @@ 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 } from '../../shared/extensionUtilities'
18
+ import { isAmazonQ , isCloud9 , isSageMaker } from '../../shared/extensionUtilities'
19
19
import { isExtensionInstalled , VSCODE_EXTENSION_ID } from '../utilities'
20
20
import { randomUUID } from '../../common/crypto'
21
21
import { activateExtension } from '../utilities/vsCodeUtils'
@@ -55,9 +55,7 @@ export class TelemetryConfig {
55
55
}
56
56
57
57
public isEnabled ( ) : boolean {
58
- return (
59
- globals . context . extension . id === VSCODE_EXTENSION_ID . amazonq ? this . amazonQConfig : this . toolkitConfig
60
- ) . get ( `telemetry` , true )
58
+ return ( isAmazonQ ( ) ? this . amazonQConfig : this . toolkitConfig ) . get ( `telemetry` , true )
61
59
}
62
60
63
61
public async initAmazonQSetting ( ) {
@@ -119,10 +117,9 @@ export async function getUserAgent(
119
117
opt ?: { includePlatform ?: boolean ; includeClientId ?: boolean } ,
120
118
globalState = globals . context . globalState
121
119
) : Promise < string > {
122
- const pairs =
123
- globals . context . extension . id === VSCODE_EXTENSION_ID . amazonq
124
- ? [ `AmazonQ-For-VSCode/${ extensionVersion } ` ]
125
- : [ `AWS-Toolkit-For-VSCode/${ extensionVersion } ` ]
120
+ const pairs = isAmazonQ ( )
121
+ ? [ `AmazonQ-For-VSCode/${ extensionVersion } ` ]
122
+ : [ `AWS-Toolkit-For-VSCode/${ extensionVersion } ` ]
126
123
127
124
if ( opt ?. includePlatform ) {
128
125
pairs . push ( platformPair ( ) )
@@ -225,7 +222,7 @@ export async function setupTelemetryId(extensionContext: vscode.ExtensionContext
225
222
await vscode . commands . executeCommand ( 'aws.amazonq.setupTelemetryId' )
226
223
} )
227
224
}
228
- } else if ( extensionContext . extension . id === VSCODE_EXTENSION_ID . amazonq ) {
225
+ } else if ( isAmazonQ ( ) ) {
229
226
getLogger ( ) . debug ( `telemetry: Set telemetry client id to ${ storedClientId } ` )
230
227
await globals . context . globalState . update ( telemetryClientIdGlobalStatekey , storedClientId )
231
228
} else {
0 commit comments