diff --git a/packages/core/src/shared/telemetry/util.ts b/packages/core/src/shared/telemetry/util.ts index dc57148393b..e6c7254e878 100644 --- a/packages/core/src/shared/telemetry/util.ts +++ b/packages/core/src/shared/telemetry/util.ts @@ -486,10 +486,15 @@ export function withTelemetryContext(opts: TelemetryContextArgs) { * Used to identify the q client info and send the respective origin parameter from LSP to invoke Maestro service at CW API level * * Returns default value of vscode appName or AmazonQ-For-SMUS-CE in case of a sagemaker unified studio environment + * Returns default value of vscode appName + * OR AmazonQ-For-SMUS-CE in case of SMUS + * OR AmazonQ-For-SMAI-CE in case of SMAI */ export function getClientName(): string { if (isSageMaker('SMUS')) { return 'AmazonQ-For-SMUS-CE' + } else if (isSageMaker('SMAI')) { + return 'AmazonQ-For-SMAI-CE' } return env.appName } diff --git a/packages/core/src/test/shared/telemetry/util.test.ts b/packages/core/src/test/shared/telemetry/util.test.ts index aa4957eea52..059d86a891e 100644 --- a/packages/core/src/test/shared/telemetry/util.test.ts +++ b/packages/core/src/test/shared/telemetry/util.test.ts @@ -419,15 +419,29 @@ describe('getClientName', function () { assert.ok(isSageMakerStub.calledOnceWith('SMUS')) }) + it('returns "AmazonQ-For-SMAI-CE" when in SMAI environment', function () { + isSageMakerStub.withArgs('SMUS').returns(false) + isSageMakerStub.withArgs('SMAI').returns(true) + sandbox.stub(vscode.env, 'appName').value('SageMaker Code Editor') + + const result = getClientName() + + assert.strictEqual(result, 'AmazonQ-For-SMAI-CE') + assert.ok(isSageMakerStub.calledWith('SMUS')) + assert.ok(isSageMakerStub.calledWith('SMAI')) + }) + it('returns vscode app name when not in SMUS environment', function () { const mockAppName = 'Visual Studio Code' isSageMakerStub.withArgs('SMUS').returns(false) + isSageMakerStub.withArgs('SMAI').returns(false) sandbox.stub(vscode.env, 'appName').value(mockAppName) const result = getClientName() assert.strictEqual(result, mockAppName) - assert.ok(isSageMakerStub.calledOnceWith('SMUS')) + assert.ok(isSageMakerStub.calledWith('SMUS')) + assert.ok(isSageMakerStub.calledWith('SMAI')) }) it('handles undefined app name gracefully', function () {