diff options
Diffstat (limited to '.github/workflows')
| -rw-r--r-- | .github/workflows/report-backend-memory.yml | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/.github/workflows/report-backend-memory.yml b/.github/workflows/report-backend-memory.yml index 30918f44db..bf2e311c83 100644 --- a/.github/workflows/report-backend-memory.yml +++ b/.github/workflows/report-backend-memory.yml @@ -85,7 +85,8 @@ jobs: --argjson VmRSS "$(calc $1 VmRSS)" \ --argjson VmHWM "$(calc $1 VmHWM)" \ --argjson VmSize "$(calc $1 VmSize)" \ - '{VmRSS: $VmRSS, VmHWM: $VmHWM, VmSize: $VmSize}') + --argjson VmData "$(calc $1 VmData)" \ + '{VmRSS: $VmRSS, VmHWM: $VmHWM, VmSize: $VmSize, VmData: $VmData}') echo "$JSON" } @@ -93,7 +94,8 @@ jobs: JSON=$(jq -c -n \ --argjson beforeGc "$(variation beforeGc)" \ --argjson afterGc "$(variation afterGc)" \ - '{beforeGc: $beforeGc, afterGc: $afterGc}') + --argjson afterRequest "$(variation afterRequest)" \ + '{beforeGc: $beforeGc, afterGc: $afterGc, afterRequest: $afterRequest}') echo "res=$JSON" >> "$GITHUB_OUTPUT" - id: build-comment @@ -108,20 +110,37 @@ jobs: echo >> ./output.md table() { + echo "| Metric | base (MB) | head (MB) | Diff (MB) | Diff (%) |" >> ./output.md + echo "|--------|------:|------:|------:|------:|" >> ./output.md + line() { + METRIC=$2 BASE=$(echo "$RES" | jq -r ".${1}.${2}.base") HEAD=$(echo "$RES" | jq -r ".${1}.${2}.head") DIFF=$(echo "$RES" | jq -r ".${1}.${2}.diff") DIFF_PERCENT=$(echo "$RES" | jq -r ".${1}.${2}.diff_percent") - echo "| ${2} | ${BASE} MB | ${HEAD} MB | ${DIFF} MB (${DIFF_PERCENT}%) |" >> ./output.md + if (( $(echo "$DIFF_PERCENT > 0" | bc -l) )); then + DIFF="+$DIFF" + DIFF_PERCENT="+$DIFF_PERCENT" + fi + + # highlight VmRSS + if [ "$2" = "VmRSS" ]; then + METRIC="**${METRIC}**" + BASE="**${BASE}**" + HEAD="**${HEAD}**" + DIFF="**${DIFF}**" + DIFF_PERCENT="**${DIFF_PERCENT}**" + fi + + echo "| ${METRIC} | ${BASE} MB | ${HEAD} MB | ${DIFF} MB | ${DIFF_PERCENT}% |" >> ./output.md } - echo "| Metric | base | head | Diff |" >> ./output.md - echo "|--------|------|------|------|" >> ./output.md line $1 VmRSS line $1 VmHWM line $1 VmSize + line $1 VmData } echo "### Before GC" >> ./output.md @@ -132,6 +151,10 @@ jobs: table afterGc echo >> ./output.md + echo "### After Request" >> ./output.md + table afterRequest + echo >> ./output.md + # Determine if this is a significant change (more than 5% increase) if [ "$(echo "$RES" | jq -r '.afterGc.VmRSS.diff_percent | tonumber > 5')" = "true" ]; then echo "⚠️ **Warning**: Memory usage has increased by more than 5%. Please verify this is not an unintended change." >> ./output.md |