fix: [bots] remove wait for logger #3711
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
The
waitForLogger
utility is extremely inconsistant in production and has proven to be dangerous to use. If this utility is called before all GCP logs have fully flushed out of the stream the process will hang until it times out, producing no logs. This makes it very difficult to figure out what's going wrong with the bots and to debug.Unfortunately, there is no easy solution to this. Ideally, we want a utility that can halt code execution until all streams have been fully flushed (i.e all upstream messages sent). This is not posible with Winston. Note that their documentation claims this is posible but in practice it just does not work. See this PR for the best solution I've found (which inspired the original implementation of
waitForLogger
). Note that the code here does not work any more with GCP's@google-cloud/logging-winston
package.There are a number of people complaining about the same issue with
@google-cloud/logging-winston
. see issue 502 and issue 598 and there is no clear solution for now.Details
Removes all usage of
waitForLogger
instances and replaces with adelay
.Testing
Check a box to describe how you tested these changes and list the steps for reviewers to test.