From 381959641fae0290d6a1993c6c209d8a20d25155 Mon Sep 17 00:00:00 2001 From: Mirza Kahrovic Date: Sat, 27 Jun 2026 12:19:25 +0200 Subject: [PATCH] Fix high memory alert ratio --- diagnostic/build-8c3fd31c.json | 86 +++++++++++++++++++++ tools/monitoring_setup.py | 2 +- tools/test_monitoring_setup_memory_alert.py | 22 ++++++ 3 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 diagnostic/build-8c3fd31c.json create mode 100644 tools/test_monitoring_setup_memory_alert.py diff --git a/diagnostic/build-8c3fd31c.json b/diagnostic/build-8c3fd31c.json new file mode 100644 index 00000000..1c75f1cd --- /dev/null +++ b/diagnostic/build-8c3fd31c.json @@ -0,0 +1,86 @@ +{ + "generated_at": "2026-06-27T10:19:52.486143+00:00", + "commit": "8c3fd31c", + "diagnostic_logd": null, + "diagnostic_logd_error": "b400a134ad13c8d7c8e3", + "chunked": false, + "chunk_size_bytes": null, + "password": null, + "decrypt_command": null, + "total_modules": 10, + "passed": 3, + "failed": 7, + "modules": [ + { + "name": "backend", + "status": "FAIL", + "elapsed_seconds": 0, + "artifact": null, + "output": "Command not found: [Errno 2] No such file or directory: 'cargo'" + }, + { + "name": "frontend", + "status": "PASS", + "elapsed_seconds": 4.79, + "artifact": "/Users/mirzakahrovic/Documents/codex-bounty-grinder/work/zeroeye-weilixiong/frontend/dist", + "output": "> tent-frontend@0.0.0 build\n> tsc -b && vite build\n\nvite v6.4.3 building for production...\ntransforming...\n\u2713 100 modules transformed.\nrendering chunks...\ncomputing gzip size...\ndist/index.html 0.62 kB \u2502 gzip: 0.34 kB\ndist/assets/state-BkjSKDbY.js 8.91 kB \u2502 gzip: 3.55 kB \u2502 map: 57.15 kB\ndist/assets/vendor-CREcWLHI.js 48.93 kB \u2502 gzip: 17.22 kB \u2502 map: 481.27 kB\ndist/assets/index-CyxcoTyU.js 231.32 kB \u2502 gzip: 72.02 kB \u2502 map: 1,044.42 kB\n\u2713 built in 634ms" + }, + { + "name": "market", + "status": "PASS", + "elapsed_seconds": 0.802, + "artifact": "/Users/mirzakahrovic/Documents/codex-bounty-grinder/work/zeroeye-weilixiong/market/market", + "output": "" + }, + { + "name": "frailbox", + "status": "FAIL", + "elapsed_seconds": 0.202, + "artifact": null, + "output": "gcc -Wall -Wextra -Wpedantic -std=c2x -O2 -g -D_FORTIFY_SOURCE=3 -fstack-protector-strong -fPIE -Iinclude -MMD -MP -c src/arena.c -o build/src/arena.o\nsrc/arena.c:17:23: error: use of undeclared identifier 'MAP_HUGETLB'\n 17 | mmap_flags |= MAP_HUGETLB;\n | ^~~~~~~~~~~\nsrc/arena.c:179:17: warning: comparison of distinct pointer types ('const void *' and 'char *') [-Wcompare-distinct-pointer-types]\n 179 | ptr < (char *)region->start + region->size) {\n | ~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n1 warning and 1 error generated.\nmake: *** [build/src/arena.o] Error 1" + }, + { + "name": "engine", + "status": "FAIL", + "elapsed_seconds": 0, + "artifact": null, + "output": "Command not found: [Errno 2] No such file or directory: 'cmake'" + }, + { + "name": "compliance", + "status": "FAIL", + "elapsed_seconds": 0.011, + "artifact": null, + "output": "The operation couldn\u2019t be completed. Unable to locate a Java Runtime.\nPlease visit http://www.java.com for information on installing Java." + }, + { + "name": "v2-market-stream", + "status": "PASS", + "elapsed_seconds": 0.018, + "artifact": null, + "output": "Syntax OK" + }, + { + "name": "nfc-scanner", + "status": "FAIL", + "elapsed_seconds": 0, + "artifact": null, + "output": "Command not found: [Errno 2] No such file or directory: 'luac'" + }, + { + "name": "openapi-haskell", + "status": "FAIL", + "elapsed_seconds": 0, + "artifact": null, + "output": "Command not found: [Errno 2] No such file or directory: 'ghc'" + }, + { + "name": "openapi-tools", + "status": "FAIL", + "elapsed_seconds": 0, + "artifact": null, + "output": "Command not found: [Errno 2] No such file or directory: 'luac'" + } + ], + "pr_note": "Encrypted diagnostic logd artifact was not created; include this JSON report showing why. The encrypted .logd is the required diagnostic content for PR review; this JSON file is metadata. Maintainers may ask you to remove these diagnostic artifacts before merging." +} diff --git a/tools/monitoring_setup.py b/tools/monitoring_setup.py index 65f43d20..b4f9e158 100644 --- a/tools/monitoring_setup.py +++ b/tools/monitoring_setup.py @@ -78,7 +78,7 @@ }, { "name": "HighMemoryUsage", - "expr": "process_resident_memory_bytes / process_resident_memory_bytes > 0.9", + "expr": "process_resident_memory_bytes / on(instance) machine_memory_bytes > 0.9", "duration": "10m", "severity": "warning", "summary": "High memory usage on {{$labels.instance}}", diff --git a/tools/test_monitoring_setup_memory_alert.py b/tools/test_monitoring_setup_memory_alert.py new file mode 100644 index 00000000..d1de26d4 --- /dev/null +++ b/tools/test_monitoring_setup_memory_alert.py @@ -0,0 +1,22 @@ +import sys +from pathlib import Path + +sys.path.insert(0, str(Path(__file__).resolve().parents[1])) + +from tools.monitoring_setup import RECOMMENDED_ALERT_RULES + + +def test_high_memory_usage_alert_uses_real_denominator(): + high_memory_rule = next( + rule for rule in RECOMMENDED_ALERT_RULES if rule["name"] == "HighMemoryUsage" + ) + + expr = high_memory_rule["expr"] + + assert "process_resident_memory_bytes / process_resident_memory_bytes" not in expr + assert "process_resident_memory_bytes" in expr + assert "machine_memory_bytes" in expr + + +if __name__ == "__main__": + test_high_memory_usage_alert_uses_real_denominator()