From a09f93aef7b37e63b3909c46130c1bcfe3a15fc3 Mon Sep 17 00:00:00 2001 From: neha_gupta Date: Mon, 9 Oct 2023 23:33:17 +0530 Subject: [PATCH] remove corso start event (#4432) remove code to send `Corso start` event. #### Does this PR need a docs update or release note? - [ ] :no_entry: No #### Type of change - [ ] :broom: Tech Debt/Cleanup #### Issue(s) * https://github.com/alcionai/corso/issues/4439 #### Test Plan - [ ] :muscle: Manual --- src/cli/cli.go | 38 ----------------------------------- src/cli/repo/filesystem.go | 9 --------- src/cli/repo/s3.go | 9 --------- src/cli/utils/utils.go | 18 ----------------- src/internal/events/events.go | 1 - 5 files changed, 75 deletions(-) diff --git a/src/cli/cli.go b/src/cli/cli.go index 8fb768c11..9b6eae05c 100644 --- a/src/cli/cli.go +++ b/src/cli/cli.go @@ -17,7 +17,6 @@ import ( "github.com/alcionai/corso/src/cli/print" "github.com/alcionai/corso/src/cli/repo" "github.com/alcionai/corso/src/cli/restore" - "github.com/alcionai/corso/src/cli/utils" "github.com/alcionai/corso/src/internal/observe" "github.com/alcionai/corso/src/internal/version" "github.com/alcionai/corso/src/pkg/logger" @@ -61,43 +60,6 @@ func preRun(cc *cobra.Command, args []string) error { print.Infof(ctx, "Logging to file: %s", logger.ResolvedLogFile) } - avoidTheseDescription := []string{ - "Initialize a repository.", - "Initialize a S3 repository", - "Connect to a S3 repository", - "Initialize a repository on local or network storage.", - "Connect to a repository on local or network storage.", - "Help about any command", - "Free, Secure, Open-Source Backup for M365.", - "env var guide", - } - - if !slices.Contains(avoidTheseDescription, cc.Short) { - provider, overrides, err := utils.GetStorageProviderAndOverrides(ctx, cc) - if err != nil { - return err - } - - cfg, err := config.GetConfigRepoDetails( - ctx, - provider, - true, - false, - overrides) - if err != nil { - log.Error("Error while getting config info to run command: ", cc.Use) - return err - } - - utils.SendStartCorsoEvent( - ctx, - cfg.Storage, - cfg.Account.ID(), - map[string]any{"command": cc.CommandPath()}, - cfg.RepoID, - utils.Control()) - } - // handle deprecated user flag in Backup exchange command if cc.CommandPath() == "corso backup create exchange" { handleMailBoxFlag(ctx, cc, flagSl) diff --git a/src/cli/repo/filesystem.go b/src/cli/repo/filesystem.go index f6a495f21..7a012e503 100644 --- a/src/cli/repo/filesystem.go +++ b/src/cli/repo/filesystem.go @@ -87,15 +87,6 @@ func initFilesystemCmd(cmd *cobra.Command, args []string) error { // Retention is not supported for filesystem repos. retentionOpts := ctrlRepo.Retention{} - // SendStartCorsoEvent uses distict ID as tenant ID because repoID is still not generated - utils.SendStartCorsoEvent( - ctx, - cfg.Storage, - cfg.Account.ID(), - map[string]any{"command": "init repo"}, - cfg.Account.ID(), - opt) - storageCfg, err := cfg.Storage.ToFilesystemConfig() if err != nil { return Only(ctx, clues.Wrap(err, "Retrieving filesystem configuration")) diff --git a/src/cli/repo/s3.go b/src/cli/repo/s3.go index 3fb0833e6..000513671 100644 --- a/src/cli/repo/s3.go +++ b/src/cli/repo/s3.go @@ -102,15 +102,6 @@ func initS3Cmd(cmd *cobra.Command, args []string) error { return Only(ctx, err) } - // SendStartCorsoEvent uses distict ID as tenant ID because repoID is still not generated - utils.SendStartCorsoEvent( - ctx, - cfg.Storage, - cfg.Account.ID(), - map[string]any{"command": "init repo"}, - cfg.Account.ID(), - opt) - s3Cfg, err := cfg.Storage.ToS3Config() if err != nil { return Only(ctx, clues.Wrap(err, "Retrieving s3 configuration")) diff --git a/src/cli/utils/utils.go b/src/cli/utils/utils.go index 2ee9ac090..c27d7d8c2 100644 --- a/src/cli/utils/utils.go +++ b/src/cli/utils/utils.go @@ -239,24 +239,6 @@ func splitFoldersIntoContainsAndPrefix(folders []string) ([]string, []string) { return containsFolders, prefixFolders } -// SendStartCorsoEvent utility sends corso start event at start of each action -func SendStartCorsoEvent( - ctx context.Context, - s storage.Storage, - tenID string, - data map[string]any, - repoID string, - opts control.Options, -) { - bus, err := events.NewBus(ctx, s, tenID, opts) - if err != nil { - logger.CtxErr(ctx, err).Info("sending start event") - } - - bus.SetRepoID(repoID) - bus.Event(ctx, events.CorsoStart, data) -} - // GetStorageProviderAndOverrides returns the storage provider type and // any flags specified on the command line which are storage provider specific. func GetStorageProviderAndOverrides( diff --git a/src/internal/events/events.go b/src/internal/events/events.go index 99c1651ac..b2efa81c3 100644 --- a/src/internal/events/events.go +++ b/src/internal/events/events.go @@ -28,7 +28,6 @@ const ( tenantIDDeprecated = "m365_tenant_hash_deprecated" // Event Keys - CorsoStart = "Corso Start" RepoInit = "Repo Init" RepoConnect = "Repo Connect" BackupStart = "Backup Start"