remove corso start event (#4432)
<!-- PR description--> remove code to send `Corso start` event. #### Does this PR need a docs update or release note? - [ ] ⛔ No #### Type of change <!--- Please check the type of change your PR introduces: ---> - [ ] 🧹 Tech Debt/Cleanup #### Issue(s) <!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. --> * https://github.com/alcionai/corso/issues/4439 #### Test Plan <!-- How will this be tested prior to merging.--> - [ ] 💪 Manual
This commit is contained in:
parent
26ebe3cbe5
commit
a09f93aef7
@ -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)
|
||||
|
||||
@ -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"))
|
||||
|
||||
@ -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"))
|
||||
|
||||
@ -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(
|
||||
|
||||
@ -28,7 +28,6 @@ const (
|
||||
tenantIDDeprecated = "m365_tenant_hash_deprecated"
|
||||
|
||||
// Event Keys
|
||||
CorsoStart = "Corso Start"
|
||||
RepoInit = "Repo Init"
|
||||
RepoConnect = "Repo Connect"
|
||||
BackupStart = "Backup Start"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user