-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
feat: Track and report peak memory usage for client build #38772
base: release
Are you sure you want to change the base?
feat: Track and report peak memory usage for client build #38772
Conversation
- Added memory tracking to install, type check, and build stages - Added memory usage summary and PR comment generation - Track peak memory usage for each stage and overall peak - Exclusive RAM tracking for client build workflow Link to Devin run: https://app.devin.ai/sessions/9a905bef80d54148aa4f50ffe266cb4f Co-Authored-By: abhinav@appsmith.com <abhinav@appsmith.com>
- Added memory tracking to install, type check, and build stages - Added memory usage summary and PR comment generation - Track peak memory usage for each stage and overall peak - Exclusive RAM tracking for client build workflow Link to Devin run: https://app.devin.ai/sessions/9a905bef80d54148aa4f50ffe266cb4f Co-Authored-By: abhinav@appsmith.com <abhinav@appsmith.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
⚙️ Control Options:
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the WalkthroughThe pull request modifies the GitHub Actions workflow file Changes
Sequence DiagramsequenceDiagram
participant Workflow as GitHub Actions
participant Install as Dependency Install
participant TypeCheck as Type Checking
participant Build as Project Build
participant Memory as Memory Tracker
participant PR as Pull Request
Workflow->>Install: Run with memory tracking
Install-->>Memory: Capture peak memory
Workflow->>TypeCheck: Run with memory tracking
TypeCheck-->>Memory: Capture peak memory
Workflow->>Build: Run with memory tracking
Build-->>Memory: Capture peak memory
Memory->>PR: Comment memory usage summary
Possibly related PRs
Suggested reviewers
Poem
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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 using PR comments)
Other keywords and placeholders
Documentation and Community
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
.github/workflows/client-build.yml (2)
232-256
: Enhance memory usage reporting with formatted values and thresholds.Consider these improvements:
- Format memory values in MB/GB for better readability
- Add configurable thresholds to alert on high memory usage
# Function to extract peak memory get_peak_memory() { - grep "Maximum resident set size" "$1" | awk '{print $6}' + grep "Maximum resident set size" "$1" | awk '{ + mem=$6/1024/1024; + if(mem >= 1024) { + printf "%.2f GB", mem/1024 + } else { + printf "%.2f MB", mem + } + }' } +# Define thresholds (in KB) +MEMORY_THRESHOLD_WARNING=4194304 # 4GB +MEMORY_THRESHOLD_CRITICAL=6291456 # 6GB + # Create summary echo "Install Dependencies Peak: $PEAK_INSTALL kB" >> memory_summary.txt echo "Type Checking Peak: $PEAK_TYPECHECK kB" >> memory_summary.txt echo "Build Peak: $PEAK_BUILD kB" >> memory_summary.txt echo "Overall Peak: $OVERALL_PEAK kB" >> memory_summary.txt + +# Add threshold warnings +if [ "$OVERALL_PEAK" -gt "$MEMORY_THRESHOLD_CRITICAL" ]; then + echo "⚠️ CRITICAL: Memory usage exceeded ${MEMORY_THRESHOLD_CRITICAL}KB threshold" >> memory_summary.txt +elif [ "$OVERALL_PEAK" -gt "$MEMORY_THRESHOLD_WARNING" ]; then + echo "⚠️ WARNING: Memory usage exceeded ${MEMORY_THRESHOLD_WARNING}KB threshold" >> memory_summary.txt +fi
231-259
: Optimize multiple redirects to memory_summary.txt.Consider using a single redirection for better efficiency, as suggested by shellcheck.
-echo "Memory usage summary:" > memory_summary.txt -echo "===================" >> memory_summary.txt -echo "Install Dependencies Peak: $PEAK_INSTALL kB" >> memory_summary.txt -echo "Type Checking Peak: $PEAK_TYPECHECK kB" >> memory_summary.txt -echo "Build Peak: $PEAK_BUILD kB" >> memory_summary.txt -echo "Overall Peak: $OVERALL_PEAK kB" >> memory_summary.txt +{ + echo "Memory usage summary:" + echo "===================" + echo "Install Dependencies Peak: $PEAK_INSTALL kB" + echo "Type Checking Peak: $PEAK_TYPECHECK kB" + echo "Build Peak: $PEAK_BUILD kB" + echo "Overall Peak: $OVERALL_PEAK kB" +} > memory_summary.txt🧰 Tools
🪛 actionlint (1.7.4)
231-231: shellcheck reported issue in this script: SC2129:style:22:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects
(shellcheck)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/client-build.yml
(3 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/client-build.yml
231-231: shellcheck reported issue in this script: SC2129:style:22:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects
(shellcheck)
🔇 Additional comments (2)
.github/workflows/client-build.yml (2)
261-273
: LGTM! Clean implementation of PR comment creation.The GitHub API usage is correct, and the markdown formatting enhances readability.
138-139
: Verify platform compatibility for memory tracking commands.The
/usr/bin/time -v
command is Linux-specific and may not work on all GitHub runners. Consider adding a platform check or using a cross-platform alternative.Run this script to verify the runner platform:
Also applies to: 144-145, 179-179
✅ Verification successful
Platform compatibility is managed via runner configuration
The workflow uses a configurable runner (
${{ vars.RUNNER_CLIENT_BUILD }}
), allowing the team to ensure compatibility with the/usr/bin/time -v
command. No changes needed.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check if the runner platform supports /usr/bin/time -v echo "Runner platform: ${{ vars.RUNNER_CLIENT_BUILD }}" which time && /usr/bin/time -v echo "test" || echo "time command not available or -v not supported"Length of output: 349
Script:
#!/bin/bash # Check workflow runner configuration and setup rg "runs-on|container:" .github/workflows/client-build.ymlLength of output: 105
/build-deploy-preview skip-tests=true |
Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/12866753784. |
Deploy-Preview-URL: https://ce-38772.dp.appsmith.com |
Co-Authored-By: abhinav@appsmith.com <abhinav@appsmith.com>
Co-Authored-By: abhinav@appsmith.com <abhinav@appsmith.com>
📊 Client Build Memory Usage Report
|
…d workflow Co-Authored-By: abhinav@appsmith.com <abhinav@appsmith.com>
📊 Client Build Memory Usage Report
|
Memory Usage Tracking for Client Build
This PR adds memory usage tracking and reporting for the client build workflow. It helps monitor RAM consumption during builds to identify potential memory issues early.
Changes
/usr/bin/time -v
Implementation Details
The implementation uses
/usr/bin/time -v
to track memory usage accurately for each build stage:Memory statistics are collected and posted as a PR comment, showing:
Automation
/ok-to-test tags=""
🔍 Cypress test results
Warning
Tests have not run on the HEAD 591f23d yet
Mon, 27 Jan 2025 07:27:43 UTC
Created by Devin
Link to Devin run: https://app.devin.ai/sessions/9a905bef80d54148aa4f50ffe266cb4f
Summary by CodeRabbit