Skip to content

Add 'nfds' Monitoring and Fix FD Bug in apps.plugin - #22447

Merged
ilyam8 merged 5 commits into
netdata:masterfrom
arch-yunus:master
May 8, 2026
Merged

Add 'nfds' Monitoring and Fix FD Bug in apps.plugin#22447
ilyam8 merged 5 commits into
netdata:masterfrom
arch-yunus:master

Conversation

@arch-yunus

@arch-yunus arch-yunus commented May 7, 2026

Copy link
Copy Markdown
Contributor

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

  1. 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.

  2. 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.plugin for accurate metrics. Removes the previously proposed apps.<group>_fds_total chart and drops the SOW file per maintainer request.

  • Bug Fixes

    • Map "pipes" to w->openfds.pipes instead of sockets in apps_output.c.
  • Refactors

    • Remove redundant apps.<group>_fds_total chart.
    • Remove SOW file from the repository.

Written for commit 54b78c3. Summary will update on new commits.

@CLAassistant

CLAassistant commented May 7, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.md is 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)
Loading

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread .agents/sow/done/SOW-0013-20260507-add-nfds-monitoring.md Outdated
@ilyam8

ilyam8 commented May 7, 2026

Copy link
Copy Markdown
Member

@arch-yunus why do we need total FDs? The "Applications Groups open files descriptors" shows total by default (grouped by app group, not dimension)

Screenshot 2026-05-07 at 7 39 01 PM

@arch-yunus

Copy link
Copy Markdown
Contributor Author

@arch-yunus why do we need total FDs? The "Applications Groups open files descriptors" shows total by default (grouped by app group, not dimension)

Screenshot 2026-05-07 at 7 39 01 PM

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!

@ilyam8

ilyam8 commented May 7, 2026

Copy link
Copy Markdown
Member

please remove SOW file too

@arch-yunus

Copy link
Copy Markdown
Contributor Author

please remove SOW file too

Done! I've removed the SOW file and updated the branch. Thanks for the feedback!

@github-actions github-actions Bot added area/collectors Everything related to data collection collectors/apps labels May 7, 2026
@ilyam8

ilyam8 commented May 7, 2026

Copy link
Copy Markdown
Member

@arch-yunus Before we can merge this PR, you’ll need to sign the CLA.

@sonarqubecloud

sonarqubecloud Bot commented May 7, 2026

Copy link
Copy Markdown

@ilyam8
ilyam8 merged commit 0692e22 into netdata:master May 8, 2026
158 checks passed
@stelfrag stelfrag mentioned this pull request Jun 22, 2026
Ferroin pushed a commit that referenced this pull request Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/collectors Everything related to data collection collectors/apps

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants