Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gp] track git event with instanceId #16693

Merged
merged 1 commit into from
Mar 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[gp] track git event with instanceId
instead of workspaceInstanceId to allow cross events matching in Mixpanel
  • Loading branch information
akosyakov committed Mar 6, 2023
commit bfc626decb92cac1c33ab94436537f6cde2dbae8
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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is for future, not sure what would be consequence of moving to another source, i.e. from trusted to untrusted.

For Mixpanel there are none, not sure about other reports. cc @jakobhero @loujaybee

err = client.TrackEvent(ctx, event)
if err != nil {
log.WithError(err).Fatal("error tracking git event")
Expand Down