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

Clear the gRPC log before running a deployment #67

Merged
merged 2 commits into from
Feb 26, 2024

Conversation

EronWright
Copy link
Contributor

@EronWright EronWright commented Feb 16, 2024

This PR adds a new utility method ClearGrpcLog and uses it to clear the log before a preview, up, refresh, or destroy operation. I'm unaware of any use case for retaining the event log across deployments, and forgetting to clear it may otherwise be a common mistake. If a use case emerges, assumedly one could copy the log before running the deployment.

Copy link

codecov bot commented Feb 16, 2024

Codecov Report

Attention: Patch coverage is 70.00000% with 6 lines in your changes are missing coverage. Please review.

Project coverage is 37.25%. Comparing base (8c45fd2) to head (0808db7).
Report is 12 commits behind head on main.

Files Patch % Lines
pulumitest/grpcLog.go 25.00% 4 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #67      +/-   ##
==========================================
+ Coverage   33.45%   37.25%   +3.80%     
==========================================
  Files          42       42              
  Lines        2571     2663      +92     
==========================================
+ Hits          860      992     +132     
+ Misses       1606     1565      -41     
- Partials      105      106       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@danielrbradley danielrbradley left a comment

Choose a reason for hiding this comment

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

Having this facility to more easily correlate the log to a specific operation is definitely useful. Happy to merge this as a short term fix for now, though I'm much more interested in doing a small breaking change here to just include the log as part of each operation's result. I'll look to spike on what this would look like.

@t0yv0 any thoughts on this simple fix vs moving the log into custom response wrapper types?

pulumitest/grpcLog.go Outdated Show resolved Hide resolved
@t0yv0
Copy link
Member

t0yv0 commented Feb 21, 2024

IMO most realistic scenarios involve more than one deployment (you preview and refresh and up etc). By default PULUMI_DEBUG_GRPC is append-only so that's good to be able to capture the union of all of them, which deleting by default will prevent... I'm guessing it's not currently is not easy to separate out the logs from the one file since these log records are not labelled by deployment. Perhaps if PULUMI_DEBUG_GRPC could have some convention for disambiguating the operation phase so it becomes a file naming pattern that could be interesting.

ProgramTest does this for --trace. Exact same problem. When collecting benchmarks we needed to segregate the traces from each preview, up, destroy and so forth, so the flag is now not a file path but a pattern with {command} being substituted with a representation of what's happening, so multiple trace files are emitted from a single ProgramTest.

https://github.com/pulumi/pulumi/blob/master/pkg/testing/integration/program.go#L956

@EronWright
Copy link
Contributor Author

I leave it to you both to make up your mind about whether to clear the log, but to @t0yv0's point, the log entries aren't adequately distinguishable across deployments. 99% case is that it should be cleared. A test could simply copy the log to retain the information.

Copy link
Member

@danielrbradley danielrbradley left a comment

Choose a reason for hiding this comment

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

Let's put this in as-is and see it goes. Can always adjust later before we stabilize.

@EronWright EronWright merged commit 06d8947 into main Feb 26, 2024
4 checks passed
@EronWright EronWright deleted the eronwright/clear-rpc-log branch February 26, 2024 21:27
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

3 participants