Skip to content

Fix HighMemoryUsage alert ratio expression#26

Open
natchapolwu wants to merge 1 commit into
weilixiong:mainfrom
natchapolwu:fix-high-memory-alert-ratio
Open

Fix HighMemoryUsage alert ratio expression#26
natchapolwu wants to merge 1 commit into
weilixiong:mainfrom
natchapolwu:fix-high-memory-alert-ratio

Conversation

@natchapolwu

Copy link
Copy Markdown

Summary

Fixes the HighMemoryUsage Prometheus alert so it compares resident memory to total machine memory instead of dividing process_resident_memory_bytes by itself.

/claim #1

Changes

  • Replaced the self-dividing HighMemoryUsage expression with process_resident_memory_bytes / machine_memory_bytes > 0.9.
  • Added find_self_dividing_alerts() to reject alert rules where the same metric appears on both sides of /.
  • Added unit tests for the recommended alert rules and the self-division guard.
  • Made alert upload/init return a failure code if validation rejects a rule.

Testing

  • python -m unittest tools.test_monitoring_setup
  • python tools\monitoring_setup.py --alerts --dry-run
  • python -m py_compile tools\monitoring_setup.py tools\test_monitoring_setup.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

Notes

The repository PR template asks for a diagnostic build log. This change is a Python-only monitoring script fix, and the available local verification is the unittest/dry-run/py_compile sequence above. No full diagnostic build was run.

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