Skip to content

Commit 4172d04

Browse files
akosyakovroboquat
authored andcommitted
[supervisor] track workspaces with activated docker
1 parent 6f2af1e commit 4172d04

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

components/supervisor/pkg/supervisor/supervisor.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ func Run(options ...RunOption) {
400400

401401
if !opts.RunGP && !cfg.isDebugWorkspace() {
402402
wg.Add(1)
403-
go socketActivationForDocker(ctx, &wg, termMux)
403+
go socketActivationForDocker(ctx, &wg, termMux, cfg, telemetry)
404404
}
405405

406406
if cfg.isHeadless() {
@@ -1499,7 +1499,7 @@ func recordInitializerMetrics(path string, metrics *metrics.SupervisorMetrics) {
14991499
}
15001500
}
15011501

1502-
func socketActivationForDocker(ctx context.Context, wg *sync.WaitGroup, term *terminal.Mux) {
1502+
func socketActivationForDocker(ctx context.Context, wg *sync.WaitGroup, term *terminal.Mux, cfg *Config, w analytics.Writer) {
15031503
defer wg.Done()
15041504

15051505
fn := "/var/run/docker.sock"
@@ -1527,6 +1527,20 @@ func socketActivationForDocker(ctx context.Context, wg *sync.WaitGroup, term *te
15271527
},
15281528
LogToStdout: true,
15291529
})
1530+
outcome := "success"
1531+
if err != nil {
1532+
outcome = "failure"
1533+
}
1534+
w.Track(analytics.TrackMessage{
1535+
Identity: analytics.Identity{UserID: cfg.OwnerId},
1536+
Event: "gitpod_activate_docker",
1537+
Properties: map[string]interface{}{
1538+
"instanceId": cfg.WorkspaceInstanceID,
1539+
"workspaceId": cfg.WorkspaceID,
1540+
"outcome": outcome,
1541+
"debugWorkspace": cfg.isDebugWorkspace(),
1542+
},
1543+
})
15301544
if err != nil {
15311545
return err
15321546
}

0 commit comments

Comments
 (0)