Skip to content

Commit

Permalink
[gp] track git event with instanceId (#16693)
Browse files Browse the repository at this point in the history
instead of workspaceInstanceId to allow cross events matching in Mixpanel
  • Loading branch information
akosyakov authored Mar 6, 2023
1 parent 294aa69 commit b9f2657
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions components/gitpod-cli/cmd/git-track-command.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,19 @@ var gitTrackCommand = &cobra.Command{
defer client.Close()

type GitEventParams struct {
Command string `json:"command,omitempty"`
WorkspaceId string `json:"workspaceId,omitempty"`
Command string `json:"command,omitempty"`
WorkspaceId string `json:"workspaceId,omitempty"`
// most often used across all events
InstanceId string `json:"instanceId,omitempty"`
// deprecated for backward compatibility
WorkspaceInstanceId string `json:"workspaceInstanceId,omitempty"`
Timestamp int64 `json:"timestamp,omitempty"`
}

params := &GitEventParams{
Command: gitTrackCommandOpts.GitCommand,
WorkspaceId: wsInfo.WorkspaceId,
InstanceId: wsInfo.InstanceId,
WorkspaceInstanceId: wsInfo.InstanceId,
Timestamp: time.Now().Unix(),
}
Expand All @@ -76,6 +80,7 @@ var gitTrackCommand = &cobra.Command{
log.WithField("command", gitTrackCommandOpts.GitCommand).
Info("tracking the GitCommand event")

// TODO(ak) use segment directly + supervisor info to get workspace and isntance IDs, don't use server
err = client.TrackEvent(ctx, event)
if err != nil {
log.WithError(err).Fatal("error tracking git event")
Expand Down

0 comments on commit b9f2657

Please sign in to comment.