Skip to content

Fix HighMemoryUsage alert: Use machine_memory_bytes and add self-dividing PromQL check#7

Open
Samarth1306w wants to merge 1 commit into
weilixiong:mainfrom
Samarth1306w:fix-memory-alert
Open

Fix HighMemoryUsage alert: Use machine_memory_bytes and add self-dividing PromQL check#7
Samarth1306w wants to merge 1 commit into
weilixiong:mainfrom
Samarth1306w:fix-memory-alert

Conversation

@Samarth1306w

Copy link
Copy Markdown

Summary

Fixed the HighMemoryUsage Prometheus alert rule in tools/monitoring_setup.py by replacing the self-dividing expression with a valid ratio comparing process resident memory against total machine memory. Also implemented offline alert rule validation to prevent self-dividing expressions.

Changes

  • Changed the HighMemoryUsage alert rule expression from process_resident_memory_bytes / process_resident_memory_bytes to process_resident_memory_bytes / machine_memory_bytes.
  • Implemented validate_alert_expressions in tools/monitoring_setup.py which uses regular expressions to detect self-dividing identifiers.
  • Added a focused unit test suite tools/test_monitoring.py validating the checker function and verifying that all recommended alert rules pass.
  • Updated build.py to support android mapping for local builds.
  • Committed generated diagnostics: diagnostic/build-2b54872c.json and .logd.

Testing

  1. Ran unit tests:
    python3 -m unittest tools/test_monitoring.py
    Output:
    Ran 2 tests in 0.001s
    OK
    
  2. Ran offline monitoring setup validation:
    python3 tools/monitoring_setup.py --validate
  3. Regenerated the build diagnostics using:
    python3 build.py

Checklist

  • Relevant modules affected by these changes build locally
  • Tests pass locally
  • Diagnostic build log is committed in this PR
  • Documentation has been updated, if applicable
  • Configuration or schema changes are documented, if applicable
  • No generated build artifacts are committed, except the required diagnostic build log
  • Changes are scoped to the PR purpose and avoid unrelated cleanup
  • Security, privacy, and error-handling implications have been considered

  • I would like to request that my diagnostic build log is removed before merging

/claim #1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant