Skip to content

Commit 614766c

Browse files
Merge staging into feature/lambda-get-started
2 parents 2f07453 + 6bc6cf1 commit 614766c

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

packages/core/src/amazonqFeatureDev/client/codewhispererruntime-2022-11-11.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,6 +1036,15 @@
10361036
},
10371037
"documentation": "<p>Represents the state of an Editor</p>"
10381038
},
1039+
"FeatureDevEvent": {
1040+
"type": "structure",
1041+
"required": ["conversationId"],
1042+
"members": {
1043+
"conversationId": {
1044+
"shape": "ConversationId"
1045+
}
1046+
}
1047+
},
10391048
"FeatureEvaluation": {
10401049
"type": "structure",
10411050
"required": ["feature", "variation", "value"],
@@ -1918,6 +1927,9 @@
19181927
},
19191928
"metricData": {
19201929
"shape": "MetricData"
1930+
},
1931+
"featureDevEvent": {
1932+
"shape": "FeatureDevEvent"
19211933
}
19221934
},
19231935
"union": true

packages/core/src/amazonqFeatureDev/client/featureDev.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,4 +308,34 @@ export class FeatureDevClient {
308308
throw new ToolkitError((e as Error).message, { code: 'ExportResultArchiveFailed' })
309309
}
310310
}
311+
312+
/**
313+
* This event is specific to ABTesting purposes.
314+
*
315+
* No need to fail currently if the event fails in the request. In addition, currently there is no need for a return value.
316+
*
317+
* @param conversationId
318+
*/
319+
public async sendFeatureDevTelemetryEvent(conversationId: string) {
320+
try {
321+
const client = await this.getClient()
322+
const params: FeatureDevProxyClient.SendTelemetryEventRequest = {
323+
telemetryEvent: {
324+
featureDevEvent: {
325+
conversationId,
326+
},
327+
},
328+
}
329+
const response = await client.sendTelemetryEvent(params).promise()
330+
getLogger().debug(
331+
`${featureName}: successfully sent featureDevEvent: ConversationId: ${conversationId} RequestId: ${response.$response.requestId}`
332+
)
333+
} catch (e) {
334+
getLogger().error(
335+
`${featureName}: failed to send feature dev telemetry: ${(e as Error).name}: ${
336+
(e as Error).message
337+
} RequestId: ${(e as any).requestId}`
338+
)
339+
}
340+
}
311341
}

packages/core/src/amazonqFeatureDev/session/session.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export class Session {
6161
await this.setupConversation(msg)
6262
this.preloaderFinished = true
6363
this.messenger.sendAsyncEventProgress(this.tabID, true, undefined)
64+
await this.proxyClient.sendFeatureDevTelemetryEvent(this.conversationId) // send the event only once per conversation.
6465
}
6566
}
6667

0 commit comments

Comments
 (0)