Skip to content

Commit ddefe0f

Browse files
authored
Merge branch 'master' into floralph/nep-bug-fix
2 parents 78ddc0a + 12efddd commit ddefe0f

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,10 +486,15 @@ export function withTelemetryContext(opts: TelemetryContextArgs) {
486486
* Used to identify the q client info and send the respective origin parameter from LSP to invoke Maestro service at CW API level
487487
*
488488
* Returns default value of vscode appName or AmazonQ-For-SMUS-CE in case of a sagemaker unified studio environment
489+
* Returns default value of vscode appName
490+
* OR AmazonQ-For-SMUS-CE in case of SMUS
491+
* OR AmazonQ-For-SMAI-CE in case of SMAI
489492
*/
490493
export function getClientName(): string {
491494
if (isSageMaker('SMUS')) {
492495
return 'AmazonQ-For-SMUS-CE'
496+
} else if (isSageMaker('SMAI')) {
497+
return 'AmazonQ-For-SMAI-CE'
493498
}
494499
return env.appName
495500
}

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,15 +419,29 @@ describe('getClientName', function () {
419419
assert.ok(isSageMakerStub.calledOnceWith('SMUS'))
420420
})
421421

422+
it('returns "AmazonQ-For-SMAI-CE" when in SMAI environment', function () {
423+
isSageMakerStub.withArgs('SMUS').returns(false)
424+
isSageMakerStub.withArgs('SMAI').returns(true)
425+
sandbox.stub(vscode.env, 'appName').value('SageMaker Code Editor')
426+
427+
const result = getClientName()
428+
429+
assert.strictEqual(result, 'AmazonQ-For-SMAI-CE')
430+
assert.ok(isSageMakerStub.calledWith('SMUS'))
431+
assert.ok(isSageMakerStub.calledWith('SMAI'))
432+
})
433+
422434
it('returns vscode app name when not in SMUS environment', function () {
423435
const mockAppName = 'Visual Studio Code'
424436
isSageMakerStub.withArgs('SMUS').returns(false)
437+
isSageMakerStub.withArgs('SMAI').returns(false)
425438
sandbox.stub(vscode.env, 'appName').value(mockAppName)
426439

427440
const result = getClientName()
428441

429442
assert.strictEqual(result, mockAppName)
430-
assert.ok(isSageMakerStub.calledOnceWith('SMUS'))
443+
assert.ok(isSageMakerStub.calledWith('SMUS'))
444+
assert.ok(isSageMakerStub.calledWith('SMAI'))
431445
})
432446

433447
it('handles undefined app name gracefully', function () {

0 commit comments

Comments
 (0)