@@ -60,7 +60,7 @@ import {
60
60
WorkspaceInstanceStatus ,
61
61
WorkspaceTimeoutDuration ,
62
62
} from "@gitpod/gitpod-protocol" ;
63
- import { IAnalyticsWriter } from "@gitpod/gitpod-protocol/lib/analytics" ;
63
+ import { IAnalyticsWriter , TrackMessage } from "@gitpod/gitpod-protocol/lib/analytics" ;
64
64
import { AttributionId } from "@gitpod/gitpod-protocol/lib/attribution" ;
65
65
import { Deferred } from "@gitpod/gitpod-protocol/lib/util/deferred" ;
66
66
import { LogContext , log } from "@gitpod/gitpod-protocol/lib/util/logging" ;
@@ -616,20 +616,28 @@ export class WorkspaceStarter {
616
616
}
617
617
increaseSuccessfulInstanceStartCounter ( retries ) ;
618
618
619
+ const trackProperties : TrackMessage [ "properties" ] = {
620
+ workspaceId : workspace . id ,
621
+ instanceId : instance . id ,
622
+ projectId : workspace . projectId ,
623
+ contextURL : workspace . contextURL ,
624
+ type : workspace . type ,
625
+ class : instance . workspaceClass ,
626
+ ideConfig : instance . configuration ?. ideConfig ,
627
+ usesPrebuild : startRequest . getSpec ( ) ?. getInitializer ( ) ?. hasPrebuild ( ) ,
628
+ } ;
629
+
630
+ if ( workspace . projectId && trackProperties . usesPrebuild && workspace . type === "regular" ) {
631
+ const project = await this . projectDB . findProjectById ( workspace . projectId ) ;
632
+ trackProperties . prebuildTriggerStrategy =
633
+ project ?. settings ?. prebuilds ?. triggerStrategy ?? "webhook-based" ;
634
+ }
635
+
619
636
// update analytics
620
637
this . analytics . track ( {
621
638
userId : user . id ,
622
639
event : "workspace_started" ,
623
- properties : {
624
- workspaceId : workspace . id ,
625
- instanceId : instance . id ,
626
- projectId : workspace . projectId ,
627
- contextURL : workspace . contextURL ,
628
- type : workspace . type ,
629
- class : instance . workspaceClass ,
630
- ideConfig : instance . configuration ?. ideConfig ,
631
- usesPrebuild : startRequest . getSpec ( ) ?. getInitializer ( ) ?. hasPrebuild ( ) ,
632
- } ,
640
+ properties : trackProperties ,
633
641
timestamp : new Date ( instance . creationTime ) ,
634
642
} ) ;
635
643
} catch ( err ) {
0 commit comments