feat(healthcheck): make memory check cgroup-aware with host fallback#1
Merged
MM25Zamanian merged 1 commit intomainfrom Feb 23, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
/sys/fs/cgroup/memory.max+/sys/fs/cgroup/memory.current) and fall back to cgroup v1 or host metrics when limits are unlimited or unavailable.Description
packages/healthcheck/src/checks/memory.tsthat reads v2 files and two common v1 path variants and returns aMemorySnapshotwhen a finite container limit is detected.memory.max === "max"(v2) and very large v1 limits (heuristic2 ** 60) as unlimited and fall back to host metrics fromsysteminformation.mem()while keeping the existing free-ratio threshold checks unchanged.metrics.source("cgroup" | "host") and preserved the existing API surface and free/degraded/unhealthy logic; all cgroup reads are guarded to avoid crashes when files are missing.packages/healthcheck/scripts/print-memory-source.mjsand amemory:inspectscript entry inpackages/healthcheck/package.jsonto print computed source and values.Testing
pnpm --filter @nexload-sdk/healthcheck buildwhich completed successfully.pnpm --filter @nexload-sdk/healthcheck memory:inspectwhich executed the new script and printed the computedmetrics.sourceand memory values successfully in this environment.pnpm --filter @nexload-sdk/healthcheck lintwhich failed in this environment due to a workspace@nexload-sdk/eslint-configexport issue (ERR_PACKAGE_PATH_NOT_EXPORTED), not related to the changes in the healthcheck logic.Codex Task