cli: send command path in telemetry data (#4095)

This commit is contained in:
Aravind Shankar 2020-03-26 08:38:54 +05:30 committed by GitHub
parent 94b3550d15
commit 13e8a3c010
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 7 additions and 3 deletions

View File

@ -25,6 +25,7 @@
### Other changes
- cli: fix command path not being set in telemetry data (close #4127)
- fix deploy script to upload github release assets
- cli: fix parse error returned on console api (close #4126)
- console and cli-ext: fix parsing of wrapped types in SDL

View File

@ -20,6 +20,7 @@ func NewActionsCmd(ec *cli.ExecutionContext) *cobra.Command {
Short: "Manage actions on hasura",
SilenceUsage: true,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
cmd.Root().PersistentPreRun(cmd, args)
ec.Viper = v
err := ec.Prepare()
if err != nil {

View File

@ -16,6 +16,7 @@ func NewMetadataCmd(ec *cli.ExecutionContext) *cobra.Command {
Aliases: []string{"md"},
Short: "Manage Hasura GraphQL Engine metadata saved in the database",
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
cmd.Root().PersistentPreRun(cmd, args)
ec.Viper = v
err := ec.Prepare()
if err != nil {

View File

@ -36,6 +36,7 @@ func NewMigrateCmd(ec *cli.ExecutionContext) *cobra.Command {
Short: "Manage migrations on the database",
SilenceUsage: true,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
cmd.Root().PersistentPreRun(cmd, args)
ec.Viper = v
err := ec.Prepare()
if err != nil {

View File

@ -48,6 +48,7 @@ https://github.com/hasura/cli-plugins-index
Please open pull requests against this repo to add new plugins`,
SilenceUsage: true,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
cmd.Root().PersistentPreRun(cmd, args)
return ec.PluginsConfig.Repo.EnsureCloned()
},
}

View File

@ -34,8 +34,6 @@ var rootCmd = &cobra.Command{
SilenceUsage: true,
SilenceErrors: true,
PersistentPreRun: func(cmd *cobra.Command, args []string) {
ec.Telemetry.Command = cmd.CommandPath()
if cmd.Use != updateCLICmdUse {
if update.ShouldRunCheck(ec.LastUpdateCheckFile) && ec.GlobalConfig.ShowUpdateNotification && !ec.SkipUpdateCheck {
u := &updateOptions{
@ -116,10 +114,11 @@ func Execute() error {
if err != nil {
return errors.Wrap(err, "preparing execution context failed")
}
err = NewDefaultHasuraCommand().Execute()
execCmd, err := NewDefaultHasuraCommand().ExecuteC()
if err != nil {
ec.Telemetry.IsError = true
}
ec.Telemetry.Command = execCmd.CommandPath()
ec.Telemetry.Beam()
if ec.Spinner != nil {
ec.Spinner.Stop()