Skip to content

Conversation

@andreafalzetti
Copy link
Contributor

@andreafalzetti andreafalzetti commented Jan 23, 2023

Description

This PR adds analytics to the gp CLI. This will help us understand which commands are most and least useful.

All commands updated

Related Issue(s)

Fixes #10349

How to test

  1. start a workspace in this preview environment
  2. use segment to check event.
  3. all commands should send track event, except send-analytics itself, if the command success, outcome should be success, if the command failed, the outcome should be system_error or user_error depending on the error.
  4. we might not able to trace gp stop command, because at that time, the workspace is going to stop.
  • credential-helper
  • docs
  • env
  • git-token-validator
  • git-track-command
  • info
  • init
  • open
  • ports await
  • ports expose - skip
  • ports list
  • ports visibility
  • preview
  • rebuild
  • snapshot
  • stop
  • sync await
  • sync done
  • tasks attach
  • tasks list
  • tasks stop
  • timeout extend
  • timeout set
  • timeout show
  • top
  • url
  • version

Release Notes

NONE 

Documentation

Werft options:

  • /werft with-local-preview
    If enabled this will build install/preview
  • /werft with-preview
  • /werft with-large-vm
  • /werft with-integration-tests=all
    Valid options are all, workspace, webapp, ide, jetbrains, vscode, ssh
  • /werft analytics=segment
@werft-gitpod-dev-com
Copy link

started the job as gitpod-build-af-gp-analytics.1 because the annotations in the pull request description changed
(with .werft/ from main)

@andreafalzetti
Copy link
Contributor Author

@akosyakov this is almost done, it would be nice if someone can pick it up and merge it

@akosyakov
Copy link
Member

akosyakov commented Jan 25, 2023

@andreafalzetti thank you ❤️

@akosyakov
Copy link
Member

@iQQBot iQQBot changed the title Af/gp analytics [gitpod-cli] add command analytics Jan 31, 2023
}
if action != "get" {
return
return nil
Copy link
Contributor

Choose a reason for hiding this comment

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

this is not error, no matter previous err is nil or not

ClusterHost: wsInfo.WorkspaceClusterHost,
}

if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

actually this is a bug, because it need check err first, otherwise wsInfo will be nil, and wsInfo.WorkspaceId make program crash

Hidden: true,
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) (err error) {
defer os.Exit(0)
Copy link
Contributor

Choose a reason for hiding this comment

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

make sure this command is called os.Exit or log. Fatal to exit, because it doesn't wanna be sent track event.

@iQQBot iQQBot marked this pull request as ready for review February 1, 2023 07:01
@iQQBot iQQBot requested a review from a team February 1, 2023 07:01
@akosyakov
Copy link
Member

akosyakov commented Feb 1, 2023

@iQQBot i dont think we need analytics for credential helper and it’s supporting commands like token validator and so on… not sure about error reprting

@iQQBot
Copy link
Contributor

iQQBot commented Feb 1, 2023

@iQQBot i dont think we need analytics for credential helper and it’s supporting commands like token validator and so on… not sure about error reprting

added ignore

@mustard-mh mustard-mh self-requested a review February 1, 2023 07:46
@iQQBot
Copy link
Contributor

iQQBot commented Feb 1, 2023

/werft run

👍 started the job as gitpod-build-af-gp-analytics.19
(with .werft/ from main)

@iQQBot iQQBot force-pushed the af/gp-analytics branch 2 times, most recently from 15d49e1 to 210e95a Compare February 6, 2023 15:08
@akosyakov
Copy link
Member

@iQQBot is it ok to retest it? the build is red

@akosyakov
Copy link
Member

akosyakov commented Feb 8, 2023

/werft run

👍 started the job as gitpod-build-af-gp-analytics.42
(with .werft/ from main)

Use: "await <port>",
Short: "Waits for a process to listen on a port",
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
Copy link
Member

Choose a reason for hiding this comment

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

@iQQBot interruption does not work for this command

RunE: func(cmd *cobra.Command, args []string) error {
srcp, err := strconv.ParseUint(args[0], 10, 16)
if err != nil {
log.Fatalf("local-port cannot be parsed as int: %s", err)
Copy link
Member

Choose a reason for hiding this comment

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

@iQQBot should be invalid_arg as well

)

func stopDebugContainer(ctx context.Context, dockerPath string) {
func stopDebugContainer(ctx context.Context, dockerPath string) error {
Copy link
Member

Choose a reason for hiding this comment

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

it never should return error

ForceResize: forceResize,
Interactive: interactive,
})
if err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

@iQQBot I got system erro by typing exit in attached terminal. It should be success in this case?

i.e. create VS Code terminal do gp tasks attach and then run exit

signal.Notify(stopch, syscall.SIGTERM|syscall.SIGINT)
select {
case err := <-errchan:
if err != io.EOF {
Copy link
Member

Choose a reason for hiding this comment

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

@iQQBot maybe it could be exec.ExitError?

Copy link
Member

@akosyakov akosyakov left a comment

Choose a reason for hiding this comment

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

I tried, there is one major thing with gp ports await not respecting interruptions. Everything else is alright. Please address before merging.

/hold

Co-authored-by: Andrea Falzetti <andrea@gitpod.io>
@werft-gitpod-dev-com
Copy link

started the job as gitpod-build-af-gp-analytics.46 because the annotations in the pull request description changed
(with .werft/ from main)

@roboquat roboquat merged commit 3523934 into main Feb 8, 2023
@roboquat roboquat deleted the af/gp-analytics branch February 8, 2023 16:43
@roboquat roboquat added deployed: IDE IDE change is running in production deployed Change is completely running in production labels Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deployed: IDE IDE change is running in production deployed Change is completely running in production release-note-none size/XXL team: IDE

6 participants