-
Notifications
You must be signed in to change notification settings - Fork 114
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
Tidy excessive logs #1165
Tidy excessive logs #1165
Conversation
This is a performance optimization I found while investigating why so many log statements were printed when there were no unprocessed inputs. when userInputList is `[]`, we should return early.
While investigating excessive log statements, I found several repetitive logs for config retrieval. There were several retrievals occuring in parallel because the retrieval is not synchronous but was being requested by multiple parts of the codebase in succession. A better pattern is to cache the promise rather than only caching the result once the promise completes I also updated the return type of getConfig to properly reflect that the promise could resolve as `null`. Throughout the codebase we already account for the possibility of it being null almost everywhere except tests. enketoHelper is the one place I saw that config being null could have been an issue. For tests, we just tell TypeScript to assert non-null with `!`
This is one area we have been lacking in logs. Adds a standardized way to log on each commHelper function, including: the function called, the arguments passed, the message posted to the server (if applicable), and the result of the call For functions with lightweight response data, the full JSON is logged; for heavy response data, the log just counts # of entries I commented out unused commHelper functions
@JGreenlee should I go ahead and merge this along with this weekend's changes? |
Yes. There might be more log statements to clean up later, but this is what I had time for this week |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1165 +/- ##
==========================================
- Coverage 30.10% 30.01% -0.10%
==========================================
Files 118 118
Lines 5201 5184 -17
Branches 1162 1162
==========================================
- Hits 1566 1556 -10
+ Misses 3631 3624 -7
Partials 4 4
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Logs have gotten very cluttered, which is causing issues with the size of the LoggerDB, and is likely inhibiting performance
I am removing logs that happen repeatedly; e.g.
I am being careful not to remove logs that would be useful for debugging, since logs are critical to ensuring we can resolve bugs affecting end users.