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

refactor: replaced dbg! with trace macro #1314

Merged
merged 10 commits into from
Jun 10, 2022

Conversation

taddes
Copy link
Contributor

@taddes taddes commented May 24, 2022

Description

Simple change to replace dbg! marco with the slog-rs trace! macro, since the dbg! was resulting in stderr output, not to stdout.

Testing

Compiles and matches patterns in rest of handlers.rs file.
Had to make alterations within the .circleci yaml file. @pjenvey was essential in identifying issue where cargo build pulls in most recent rust version which is often at odds with the specified version in the Docker build, which is explicitly hard-coded.
Commented out commands to build rust and update which would override specified version in CI/CD. In the future, these lines can be commented back in and a | inserted at start of command directive.
Also, it was necessary to add the no_output_timeout directive to cargo build to allow for longer compilation times.

How should reviewers test?
Ensure GCP logs show output of trace!("Batch: Appending to {}", &new_batch.id); replacing previous dbg! here

Issue(s)

Closes link.

@taddes
Copy link
Contributor Author

taddes commented May 24, 2022

@pjenvey hoping to discuss this and get some additional context on slog-rs and if there is a better pattern. Also need to ensure I can verify the output from slog in GCP.

@taddes taddes changed the title WIP replaced dbg! with trace macro refactor: replaced dbg! with trace macro May 26, 2022
@taddes taddes marked this pull request as ready for review May 26, 2022 21:37
@@ -10,10 +10,10 @@ commands:
steps:
- run:
name: Setup Rust
command: |
rustup install stable
Copy link
Contributor

Choose a reason for hiding this comment

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

Were these commands commented out just because there was a temporary mismatch between the Rust version specified in the Dockerfile and the Rust version being pulled in here? If so, we can probably the Dockerfile and uncomment these lines now, right? Looks like there's a 1.61 buster image now: https://hub.docker.com/_/rust

Copy link
Contributor

Choose a reason for hiding this comment

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

Alternatively, do we need these commands at all if we always want to use the Rust version given to us by the Docker image?

Copy link
Member

Choose a reason for hiding this comment

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

FWIW, Rust Docker images usually are available the day after a rust release. It's been quite some time since there's been a breaking change between versions of rust, or a rust update causing something like fmt or clippy to fail. I'd be curious why those were commented out.

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 talked with Phil and he had said this had happened in previous builds. I did a commenting out of the steps here so as to not eliminate them until we'd discussed the need or lack of need to have those commands there. There were no local compilation issues on my machine and it was the CircleCI builds breaking due to this reason and we found some evidence of other cases.

@@ -57,6 +57,7 @@ commands:
- run:
name: cargo build
command: cargo build
no_output_timeout: 20m
Copy link
Member

Choose a reason for hiding this comment

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

Isn't cargo build fairly chatty?

20m of no output seems a bit long. Why are we using this value?

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 discussed with Phil and we thought that this helps avoid the problem of there not being chatty output, which in this case was the problem. We saw stalling on the MySQL side of things and if you look, it took 22 min to cargo-build, 32 for the docker image. If you can think of another way to handle this, it sounds good to me, but this ended up fixing the problem when it came to passing the CircleCI checks.

Copy link
Contributor

Choose a reason for hiding this comment

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

It might be worth investigating ways to cut down on the syncstorage build time as part of the sync modernization work because it is getting quite lengthy

Copy link
Contributor

Choose a reason for hiding this comment

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

FWIW, it appears the source of this may actually be a regression in Rust 1.61.0 itself. I've opened a PR (#1326) to address this by pinning Rust to 1.60.0. As @pjenvey noted here, we should probably start pinning to a particular Rust version anyway (instead of just grabbing the latest version) to ensure that the version in the Dockerfile and the version in the CircleCI file always match.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed @ethowitz! Since that PR is now merged, how would you like to proceed with closing this out given the changes in the CircleCI config? Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

You can go ahead and rebase with the master branch to pull the changes in. I think we can remove this line (the one that extends the timeout to 20 minutes). From what I can tell, I think we should also remove the rustup commands you commented out: we're using circleci images that have the correct version of rust pre-installed, so I think those commands prob aren't necessary

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I made the changes to the file, only leaving the output of what Rust version is currently built, though is there any merit to leaving the 20 min timeout? I'm letting it run now to see how long it may take to build again given these changes.

Copy link
Contributor

@ethowitz ethowitz left a comment

Choose a reason for hiding this comment

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

This looks good to me!

@taddes taddes merged commit 03c059c into master Jun 10, 2022
@taddes taddes deleted the refactor/send-batch-logs-to-stdout branch June 10, 2022 19:42
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.

Send dbg! batch logs to stdout
3 participants