Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/amazonq/src/lsp/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import vscode, { env, version } from 'vscode'
import vscode, { version } from 'vscode'
import * as nls from 'vscode-nls'
import { LanguageClient, LanguageClientOptions, RequestType, State } from 'vscode-languageclient'
import { InlineCompletionManager } from '../app/inline/completion'
Expand Down Expand Up @@ -37,6 +37,7 @@ import {
getOptOutPreference,
isAmazonLinux2,
getClientId,
getClientName,
extensionVersion,
isSageMaker,
DevSettings,
Expand Down Expand Up @@ -161,7 +162,7 @@ export async function startLanguageServer(
initializationOptions: {
aws: {
clientInfo: {
name: env.appName,
name: getClientName(),
version: version,
extension: {
name: 'AmazonQ-For-VSCode',
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/shared/extensionUtilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ function createCloud9Properties(company: string): IdeProperties {
}
}

function isSageMakerUnifiedStudio(): boolean {
export function isSageMakerUnifiedStudio(): boolean {
if (serviceName === notInitialized) {
serviceName = process.env.SERVICE_NAME ?? ''
isSMUS = serviceName === sageMakerUnifiedStudio
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/shared/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export { Prompter } from './ui/prompter'
export { VirtualFileSystem } from './virtualFilesystem'
export { VirtualMemoryFile } from './virtualMemoryFile'
export { AmazonqCreateUpload, Metric } from './telemetry/telemetry'
export { getClientId, getOperatingSystem, getOptOutPreference } from './telemetry/util'
export { getClientId, getClientName, getOperatingSystem, getOptOutPreference } from './telemetry/util'
export { extensionVersion } from './vscode/env'
export { cast } from './utilities/typeConstructors'
export * as workspaceUtils from './utilities/workspaceUtils'
Expand Down
14 changes: 13 additions & 1 deletion packages/core/src/shared/telemetry/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { mapMetadata, MetadataObj } from './telemetryLogger'
import { Result } from './telemetry.gen'
import { MetricDatum } from './clienttelemetry'
import { isValidationExemptMetric } from './exemptMetrics'
import { isAmazonQ, isCloud9, isSageMaker } from '../../shared/extensionUtilities'
import { isAmazonQ, isCloud9, isSageMaker, isSageMakerUnifiedStudio } from '../../shared/extensionUtilities'
import { isUuid, randomUUID } from '../crypto'
import { ClassToInterfaceType } from '../utilities/tsUtils'
import { asStringifiedStack, FunctionEntry } from './spans'
Expand Down Expand Up @@ -481,3 +481,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
*/
export function getClientName() {
if (isSageMaker() && isSageMakerUnifiedStudio()) {
Copy link

@sdharani91 sdharani91 Jul 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Why do we need both these conditions?
  2. Note that in flare code, the clientInfo check is for a top level field. So we will need to modify that to also check for clientInfo under aws in initialializationOptions.

Copy link
Contributor Author

@parameja1 parameja1 Jul 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. isSageMaker logic is such that it returns true for a SageMaker environment, hence it will be true for both SMAI and SMUS case, added additional check for SMUS to not affect SMAI
  2. Ack, will make the change to also refer the clientInfo under aws field

return 'AmazonQ-For-SMUS-CE'
}
return env.appName
}