Add 'nfds' Monitoring and Fix FD Bug in apps.plugin - #22447
Conversation
There was a problem hiding this comment.
1 issue found across 2 files
Confidence score: 5/5
- This PR looks low risk to merge: the only reported issue is low severity (3/10) and is documentation/process-oriented rather than a functional regression.
- The concern in
.agents/sow/done/SOW-0013-20260507-add-nfds-monitoring.mdis that durable SOW content retains raw request/fork identifiers, so the impact is mainly around redaction hygiene and not runtime behavior. - Pay close attention to
.agents/sow/done/SOW-0013-20260507-add-nfds-monitoring.md- replace user-specific details with placeholders/redactions before or soon after merge.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name=".agents/sow/done/SOW-0013-20260507-add-nfds-monitoring.md">
<violation number="1" location=".agents/sow/done/SOW-0013-20260507-add-nfds-monitoring.md:15">
P3: Durable SOW text should use placeholders/redactions for user-specific content, but this file preserves the raw request and fork identifier.</violation>
</file>
Architecture diagram
sequenceDiagram
participant KP as Kernel /proc
participant AP as apps.plugin
participant OC as Output Collector (apps_output.c)
participant NC as Netdata Client (dashboard)
Note over KP,NC: Runtime data flow for file descriptor monitoring
loop Every update_every seconds
AP->>KP: Read /proc/*/fd (scan process FDs)
KP-->>AP: Raw FD counts per process (files, sockets, pipes, etc.)
AP->>AP: Aggregate per application group (target w)
AP->>AP: Calculate pid_openfds_sum(w) (sum of all FD types)
AP->>OC: send_collected_data_to_netdata()
alt Normal data flow
OC->>OC: Fix: send_SET("pipes", w->openfds.pipes) (was incorrectly sockets)
OC->>OC: Send individual FD dimensions (files, sockets, pipes, inotifies, etc.)
OC-->>NC: BEGIN / SET / END for fds_open chart
OC->>OC: New: send_BEGIN(type, w, "fds_total")
OC->>OC: send_SET("total", pid_openfds_sum(w))
OC-->>NC: BEGIN / SET / END for fds_total chart
end
alt First run or chart definition needed
OC->>OC: send_file_charts_to_netdata()
OC-->>NC: CHART ..._fds_total definition (line 20205)
OC-->>NC: DIMENSION "total" (absolute, 1:1 scale)
OC-->>NC: CLABEL with group name
end
alt Obsolete condition
OC-->>NC: CHART ..._fds_total (obsolete flag set)
end
end
Note over NC: Dashboard displays new apps.<group>_fds_total chart<br/>with single "total" dimension (sum of all FDs)
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
@arch-yunus why do we need total FDs? The "Applications Groups open files descriptors" shows total by default (grouped by app group, not dimension)
|
You're right, fds_total is redundant. Since fds_open is a stacked chart, its total is already available in the legend and on hover. Furthermore, Netdata's summary view for 'Applications Groups' (grouped by app group) already presents the sum of all dimensions (the total FDs) as the value for each app group dimension. I have removed the redundant fds_total chart and kept the detailed breakdown in fds_open and the percentage-based fds_open_limit chart. Thank you for the catch! |
|
please remove SOW file too |
Done! I've removed the SOW file and updated the branch. Thanks for the feedback! |
|
@arch-yunus Before we can merge this PR, you’ll need to sign the CLA. |
|
(cherry picked from commit 0692e22)





Overview
This PR enhances the apps.plugin by adding a total file descriptors ('nfds') summary chart and fixes a bug where pipe counts were incorrectly reported using socket counts.
Changes
Bug Fix: Correct Pipe Count Reporting
In src/collectors/apps.plugin/apps_output.c, the dimension "pipes" was incorrectly mapped to w->openfds.sockets. This has been corrected to use w->openfds.pipes to ensure accurate reporting of pipe-related file descriptors.
New Feature: Total File Descriptors ('nfds') Monitoring
To provide a quick overview of resource usage per application group, a new chart apps.fds_total has been added. This chart reports the sum of all open file descriptors (files, sockets, pipes, inotifies, etc.) for each monitored application group.
Chart ID: apps._fds_total
Metric: Total open file descriptors
Parity: This brings apps.plugin closer to the feature set of other process monitoring tools like prmon, facilitating easier resource leak detection at a glance.
Verification Results
Manual Test
Verified that the apps.plugin output protocol now includes:
Corrected SET "pipes" ... values using local debug runs.
New CHART ..._fds_total definition and corresponding SET "total" ... values matching the sum of individual FD types.
Screenshots / Visuals
(Note: The new apps.fds_total chart will automatically appear in the "Applications" section of the Netdata dashboard under each application group's FD section).
Summary by cubic
Fixes incorrect pipe FD reporting in
apps.pluginfor accurate metrics. Removes the previously proposedapps.<group>_fds_totalchart and drops the SOW file per maintainer request.Bug Fixes
w->openfds.pipesinstead ofsocketsinapps_output.c.Refactors
apps.<group>_fds_totalchart.Written for commit 54b78c3. Summary will update on new commits.