Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

feat/gitserver: don't log memoryObservation error if it occured b/c context cancellation#63210

Merged
ggilmore merged 1 commit into
mainfrom
06-11-feat_gitserver_don_t_log_memoryobservation_error_if_it_occured_b_c_context_cancellation
Jun 11, 2024
Merged

feat/gitserver: don't log memoryObservation error if it occured b/c context cancellation#63210
ggilmore merged 1 commit into
mainfrom
06-11-feat_gitserver_don_t_log_memoryobservation_error_if_it_occured_b_c_context_cancellation

Conversation

@ggilmore

@ggilmore ggilmore commented Jun 11, 2024

Copy link
Copy Markdown
Contributor

This PR changes the behavior of the git cli commands to ignore errors from the memory observer if they occurred due to cancellation. Such errors are expected if the user cancels the request, and so there is no reason to generate logspam.

Test plan

Existing CI tests

This PR only reduces logspam, and as such doesn't need extensive new unit tests.

Changelog

  • Reduce logspam in the gitserver command functionality by ignoring memory observation errors if they occurred due to external context cancellation.

@cla-bot cla-bot Bot added the cla-signed label Jun 11, 2024

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @ggilmore and the rest of your teammates on Graphite Graphite

@github-actions github-actions Bot added team/product-platform team/source Tickets under the purview of Source - the one Source to graph it all labels Jun 11, 2024
@ggilmore ggilmore marked this pull request as ready for review June 11, 2024 19:29
@ggilmore ggilmore requested a review from a team June 11, 2024 19:29
@ggilmore ggilmore force-pushed the 06-11-feat_gitserver_don_t_log_memoryobservation_error_if_it_occured_b_c_context_cancellation branch from e7e74ff to 6297e51 Compare June 11, 2024 19:30
Comment on lines +317 to 322
if memoryError != nil {
if !(errors.IsContextCanceled(memoryError) && errors.IsContextCanceled(rc.ctx.Err())) {
// If the context was canceled, we don't log the error as it's expected.
rc.logger.Warn("failed to get max memory usage", log.Error(memoryError))
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I wonder if it would be slightly more ergonomic if we made the observer independent of the context since you have to call stop anyways, but no blocker

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I still like the idea of being able to cancel the goroutines as soon as we know that the user cancelled the request, as opposed to having to wait for an explicit stop.

@graphite-app

graphite-app Bot commented Jun 11, 2024

Copy link
Copy Markdown

TV gif. Steve Irwin the Crocodile Hunter looking down at a body of water, turns around and gives a double thumbs-up, mouthing 'that's good.' (Added via Giphy)

@ggilmore ggilmore merged commit a21c6d9 into main Jun 11, 2024
@ggilmore ggilmore deleted the 06-11-feat_gitserver_don_t_log_memoryobservation_error_if_it_occured_b_c_context_cancellation branch June 11, 2024 19:42

Copy link
Copy Markdown
Contributor Author

Merge activity

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla-signed team/product-platform team/source Tickets under the purview of Source - the one Source to graph it all

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants