@@ -218,27 +218,39 @@ export class CWCTelemetryHelper {
218218 }
219219
220220 public recordToolUseSuggested ( toolUse : ToolUse , messageId : string ) {
221- telemetry . amazonq_toolUseSuggested . emit ( {
222- result : 'Succeeded' ,
223- cwsprChatConversationId : messageId ,
224- cwsprChatConversationType : 'AgenticChatWithToolUse' ,
225- credentialStartUrl : AuthUtil . instance . startUrl ,
226- cwsprToolName : toolUse . name ?? '' ,
227- cwsprToolUseId : toolUse . toolUseId ?? '' ,
228- } )
221+ try {
222+ telemetry . amazonq_toolUseSuggested . run ( ( span ) => {
223+ span . record ( {
224+ result : 'Succeeded' ,
225+ cwsprChatConversationId : messageId ,
226+ cwsprChatConversationType : 'AgenticChatWithToolUse' ,
227+ credentialStartUrl : AuthUtil . instance . startUrl ,
228+ cwsprToolName : toolUse . name ?? '' ,
229+ cwsprToolUseId : toolUse . toolUseId ?? '' ,
230+ } )
231+ } )
232+ } catch ( e : any ) {
233+ getLogger ( ) . info ( 'Unable to record amazonq_toolUseSuggested telemetry' )
234+ }
229235 }
230236
231237 public recordInteractionWithAgenticChat (
232238 interactionType : AgenticChatInteractionType ,
233239 message : AcceptResponseMessage | CustomFormActionMessage | StopResponseMessage
234240 ) {
235- telemetry . amazonq_interactWithAgenticChat . emit ( {
236- cwsprAgenticChatInteractionType : interactionType ,
237- result : 'Succeeded' ,
238- cwsprChatConversationId : this . getConversationId ( message . tabID ?? '' ) ?? '' ,
239- cwsprChatConversationType : 'AgenticChat' ,
240- credentialStartUrl : AuthUtil . instance . startUrl ,
241- } )
241+ try {
242+ telemetry . amazonq_interactWithAgenticChat . run ( ( span ) => {
243+ span . record ( {
244+ cwsprAgenticChatInteractionType : interactionType ,
245+ result : 'Succeeded' ,
246+ cwsprChatConversationId : this . getConversationId ( message . tabID ?? '' ) ?? '' ,
247+ cwsprChatConversationType : 'AgenticChat' ,
248+ credentialStartUrl : AuthUtil . instance . startUrl ,
249+ } )
250+ } )
251+ } catch ( e : any ) {
252+ getLogger ( ) . info ( 'Unable to record amazonq_interactWithAgenticChat telemetry' )
253+ }
242254 }
243255
244256 public recordInteractWithMessage (
0 commit comments