elimu-ai / webapp

🖥 Web application for hosting Android applications and educational content
https://hin.elimu.ai
MIT License
30 stars 55 forks source link

1726 Reduce log level within loops #1732

Closed alexander-kuruvilla closed 1 month ago

alexander-kuruvilla commented 1 month ago

Closes #1726

Changes: Reduced logger level from info to debug

coderabbitai[bot] commented 1 month ago

Walkthrough

The main change involved in this update is the reduction of logging verbosity within various scheduler classes by altering the logging level from info to debug. This adjustment is aimed at optimizing performance by reducing the number of log entries generated during execution, especially within loops.

Changes

File Path Change Summary
src/main/java/ai/elimu/tasks/LetterSoundCorrespondenceUsageCountScheduler.java Changed logging level of word.getText() from info to debug.
src/main/java/ai/elimu/tasks/LetterUsageCountScheduler.java Changed logging level of StoryBook title within a loop from info to debug.
src/main/java/ai/elimu/tasks/ParagraphWordScheduler.java Changed logging level for messages related to wordInOriginalText and word from info to debug.
src/main/java/ai/elimu/tasks/SyllableUsageCountScheduler.java Changed logging level of storyBook.getTitle() from info to debug.
src/main/java/ai/elimu/tasks/WordUsageCountScheduler.java Changed logging level of StoryBook title within a loop from info to debug.

Assessment against linked issues

Objective Addressed Explanation
Reduce log level within loops (#1726) ✅

Recent review details **Configuration used: CodeRabbit UI** **Review profile: CHILL**
Commits Files that changed from the base of the PR and between eeee67b9e7e0a9478b2a10984dc0f49f6ba98db7 and 0efe05a18df98a09633e23208b57fe922bc29069.
Files selected for processing (5) * src/main/java/ai/elimu/tasks/LetterSoundCorrespondenceUsageCountScheduler.java (2 hunks) * src/main/java/ai/elimu/tasks/LetterUsageCountScheduler.java (1 hunks) * src/main/java/ai/elimu/tasks/ParagraphWordScheduler.java (1 hunks) * src/main/java/ai/elimu/tasks/SyllableUsageCountScheduler.java (1 hunks) * src/main/java/ai/elimu/tasks/WordUsageCountScheduler.java (1 hunks)
Files skipped from review due to trivial changes (4) * src/main/java/ai/elimu/tasks/LetterUsageCountScheduler.java * src/main/java/ai/elimu/tasks/ParagraphWordScheduler.java * src/main/java/ai/elimu/tasks/SyllableUsageCountScheduler.java * src/main/java/ai/elimu/tasks/WordUsageCountScheduler.java
Files skipped from review as they are similar to previous changes (1) * src/main/java/ai/elimu/tasks/LetterSoundCorrespondenceUsageCountScheduler.java
--- Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit .` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai generate interesting stats about this repository and render them as a table.` - `@coderabbitai show all the console.log statements in this repository.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` - `@coderabbitai help me debug CodeRabbit configuration file.` Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. ### CodeRabbit Commands (invoked as PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai full review` to do a full review from scratch and review all the files again. - `@coderabbitai summary` to regenerate the summary of the PR. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository. - `@coderabbitai help` to get help. Additionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Configration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json` ### Documentation and Community - Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 0% with 11 lines in your changes missing coverage. Please review.

Project coverage is 15.26%. Comparing base (cbd78c2) to head (0efe05a).

Files Patch % Lines
.../LetterSoundCorrespondenceUsageCountScheduler.java 0.00% 5 Missing :warning:
...in/java/ai/elimu/tasks/ParagraphWordScheduler.java 0.00% 3 Missing :warning:
...java/ai/elimu/tasks/LetterUsageCountScheduler.java 0.00% 1 Missing :warning:
...va/ai/elimu/tasks/SyllableUsageCountScheduler.java 0.00% 1 Missing :warning:
...n/java/ai/elimu/tasks/WordUsageCountScheduler.java 0.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1732 +/- ## ========================================= Coverage 15.26% 15.26% Complexity 450 450 ========================================= Files 248 248 Lines 7584 7584 Branches 799 799 ========================================= Hits 1158 1158 Misses 6376 6376 Partials 50 50 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

alexander-kuruvilla commented 1 month ago

Thank you, @alexander-kuruvilla 🙂

Would you mind checking if it makes sense to make similar changes in any of the other *Scheduler.java files in the same ai.elimu.tasks package?

FYI, the daily log file size is around 200MB now, so with your changes we should be able to reduce this to make the webapp more lightweight.

ls -ash ~/.elimu-ai/lang-HIN/logs/
4.0K .    24M webapp.log             166M webapp.log.2024-07-10  189M webapp.log.2024-07-12  198M webapp.log.2024-07-14
   0 ..  884K webapp.log.2024-07-09  190M webapp.log.2024-07-11  197M webapp.log.2024-07-13

Sure @jo-elimu , I'll check the other loops in the scheduler classes and reduce to debug if viable.

I'll commit changes if any to this PR.

jo-elimu commented 1 month ago

@alexander-kuruvilla Your changes helped reduce the size of the log files by 10X. Thank you!

198M -rw-r--r-- 1 root root 198M Jul 14 23:00 webapp.log.2024-07-14
184M -rw-r--r-- 1 root root 184M Jul 15 23:28 webapp.log.2024-07-15
 18M -rw-r--r-- 1 root root  18M Jul 16 23:01 webapp.log.2024-07-16