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

CLOUDP-237254: Update remaining commands to append deployment type telemetry #2803

Merged
merged 19 commits into from Mar 26, 2024

Conversation

blva
Copy link
Contributor

@blva blva commented Mar 25, 2024

Proposed changes

Jira ticket: CLOUDP-237254

Checklist

  • I have signed the MongoDB CLA
  • I have added tests that prove my fix is effective or that my feature works
  • I have added any necessary documentation in document requirements section listed in CONTRIBUTING.md (if appropriate)
  • I have addressed the @mongodb/docs-cloud-team comments (if appropriate)
  • I have updated test/README.md (if an e2e test has been added)
  • I have run make fmt and formatted my code

Further comments

@blva blva changed the title CLOUDP-237254: Update select to use opts CLOUDP-237254: Update remaining commands to emit telemetry Mar 25, 2024
@blva blva changed the title CLOUDP-237254: Update remaining commands to emit telemetry CLOUDP-237254: Update remaining commands to append deployment type telemetry Mar 25, 2024
@blva blva marked this pull request as ready for review March 25, 2024 19:03
@blva blva requested a review from a team as a code owner March 25, 2024 19:03
@@ -28,6 +28,11 @@ func Run(ctx context.Context, opts *options.ConnectOpts) error {
return opts.Connect(ctx)
}

func PostRun(opts *options.ConnectOpts) error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

why not

Suggested change
func PostRun(opts *options.ConnectOpts) error {
func (opts *options.ConnectOpts) PostRun() error {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we can't define it there in connect.go and I found too weird to define it in the opts file, so I followed same run convention, I tried this approach before but didn't like it so kept this way

Copy link
Collaborator

Choose a reason for hiding this comment

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

it seems to me from a distance we may be falling into the same traps that made the setup command unmaintainable with complicated "inheritance" that's making commands hard to modify

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think what we can do here, is to move everything from connect_opts_atlas.go and connect_opts_local.go into connect.go then, would that make sense? if so, I can do that in a next PR to avoid growing this one, I can start the draft now

Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's open a ticket and discuss as a team if worth the effort given we plan to re write a lot of this logic

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@blva blva requested a review from gssbzn March 26, 2024 10:59
Copy link
Collaborator

@gssbzn gssbzn left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -53,6 +57,9 @@ func ConnectBuilder() *cobra.Command {
RunE: func(cmd *cobra.Command, _ []string) error {
return Run(cmd.Context(), opts)
},
PostRun: func(_ *cobra.Command, _ []string) {
PostRun(opts)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
PostRun(opts)
opts.DeploymentTelemetry.AppendDeploymentType()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we need it there so that we can test it

AppendDeploymentType().
Times(1)

PostRun(opts)
Copy link
Collaborator

Choose a reason for hiding this comment

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

given this test doesn't test much left a comment to get rid of PostRun

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is a way to future proof changes and making sure we always capture telemetry, with time maybe more values will be added here, but id'like to keep them tested

Copy link
Contributor Author

Choose a reason for hiding this comment

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

merging but feel free to pushback if there are any other reasons

@blva blva merged commit 316736d into master Mar 26, 2024
17 checks passed
@blva blva deleted the CLOUDP-237254-2 branch March 26, 2024 12:23
@fmenezes fmenezes mentioned this pull request Apr 5, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants