@@ -176,19 +176,9 @@ export class StartWorkCommand extends QuickCommand<State> {
176176 'startWork/issue/chosen' ,
177177 {
178178 ...context . telemetryContext ! ,
179+ ...buildItemTelemetryData ( result ) ,
179180 connected : true ,
180181 type : state . type ,
181- 'item.id' : getStartWorkItemIdHash ( result ) ,
182- 'item.type' : result . item . issue . type ,
183- 'item.provider' : result . item . issue . provider . id ,
184- 'item.assignees.count' : result . item . issue . assignees ?. length ?? undefined ,
185- 'item.createdDate' : result . item . issue . createdDate . getTime ( ) ,
186- 'item.updatedDate' : result . item . issue . updatedDate . getTime ( ) ,
187-
188- 'item.comments.count' : result . item . issue . commentsCount ?? undefined ,
189- 'item.upvotes.count' : result . item . issue . thumbsUpCount ?? undefined ,
190-
191- 'item.issue.state' : result . item . issue . state ,
192182 } ,
193183 this . source ,
194184 ) ;
@@ -536,27 +526,13 @@ export class StartWorkCommand extends QuickCommand<State> {
536526 state : StepState < State > ,
537527 context : Context ,
538528 ) {
539- this . container . telemetry . sendEvent (
540- 'startWork/issue/action' ,
541- {
542- ...context . telemetryContext ! ,
543- action : action ,
544- connected : true ,
545- type : state . type ,
546- 'item.id' : getStartWorkItemIdHash ( item ) ,
547- 'item.type' : item . item . issue . type ,
548- 'item.provider' : item . item . issue . provider . id ,
549- 'item.assignees.count' : item . item . issue . assignees ?. length ?? undefined ,
550- 'item.createdDate' : item . item . issue . createdDate . getTime ( ) ,
551- 'item.updatedDate' : item . item . issue . updatedDate . getTime ( ) ,
552-
553- 'item.comments.count' : item . item . issue . commentsCount ?? undefined ,
554- 'item.upvotes.count' : item . item . issue . thumbsUpCount ?? undefined ,
555-
556- 'item.issue.state' : item . item . issue . state ,
557- } ,
558- this . source ,
559- ) ;
529+ this . container . telemetry . sendEvent ( 'startWork/issue/action' , {
530+ ...context . telemetryContext ! ,
531+ ...buildItemTelemetryData ( item ) ,
532+ action : action ,
533+ connected : true ,
534+ type : state . type ,
535+ } ) ;
560536 }
561537
562538 private async getConnectedIntegrations ( ) : Promise < Map < SupportedStartWorkIntegrationIds , boolean > > {
@@ -615,6 +591,22 @@ export function getStartWorkItemIdHash(item: StartWorkItem) {
615591 return md5 ( item . item . issue . id ) ;
616592}
617593
594+ function buildItemTelemetryData ( item : StartWorkItem ) {
595+ return {
596+ 'item.id' : getStartWorkItemIdHash ( item ) ,
597+ 'item.type' : item . item . issue . type ,
598+ 'item.provider' : item . item . issue . provider . id ,
599+ 'item.assignees.count' : item . item . issue . assignees ?. length ?? undefined ,
600+ 'item.createdDate' : item . item . issue . createdDate . getTime ( ) ,
601+ 'item.updatedDate' : item . item . issue . updatedDate . getTime ( ) ,
602+
603+ 'item.comments.count' : item . item . issue . commentsCount ?? undefined ,
604+ 'item.upvotes.count' : item . item . issue . thumbsUpCount ?? undefined ,
605+
606+ 'item.issue.state' : item . item . issue . state ,
607+ } ;
608+ }
609+
618610function getOpenOnWebQuickInputButton ( integrationId : string ) : QuickInputButton | undefined {
619611 switch ( integrationId ) {
620612 case HostingIntegrationId . GitHub :
0 commit comments