Add file descriptor (nfds) monitoring to countmon - #320
Open
mohitt31 wants to merge 1 commit into
Open
Conversation
Count open file descriptors per process by enumerating /proc/PID/fd entries, aggregated across the monitored process tree. This is useful for detecting file descriptor leaks in long-running HEP workflows. The metric is non-monotonic (fd count can rise and fall), so peak and average values are tracked in the JSON summary. Includes unit tests with precooked test data (3 iterations testing rise and fall of fd count) and an integration test update to test_count.py verifying a minimum fd count per process.
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.
This adds the number of open file descriptors to countmon, alongside the process and thread counts it already tracks. For each monitored process it counts the entries under /proc/[pid]/fd and sums them, and keeps the peak like the other count metrics.
It follows the same shape as the existing nthreads handling, so the new value shows up as
nfdsin the text and JSON output with a matching max in the totals.number_of_fdsis anunsigned long longto stay consistent with the other counts.For the tests I added a countmon case to test_values that runs against precooked /proc data with 3, 5 and 2 descriptors across three iterations and checks both the per-iteration values and that the peak comes out as 5. There is also a small addition to test_count.py for the integration side.