Skip to content

in_node_exporter_metrics: fix netstat file reads - #12173

Merged
edsiper merged 1 commit into
masterfrom
in-node-exporter-read-lines-ci
Jul 29, 2026
Merged

in_node_exporter_metrics: fix netstat file reads#12173
edsiper merged 1 commit into
masterfrom
in-node-exporter-read-lines-ci

Conversation

@edsiper

@edsiper edsiper commented Jul 29, 2026

Copy link
Copy Markdown
Member

Problem

Linux builds fail in the node exporter netstat collector because two ne_utils_file_read_lines() calls still use the old three-argument signature. The helper now requires the plugin context before the mount and path arguments.

Change

Pass ctx to the /net/netstat and /net/snmp6 reads, matching the existing /net/snmp call and every other node exporter caller.

This restores compilation and preserves contextual plugin error logging for those files.

Validation

  • cmake -S . -B build -DFLB_DEV=on -DFLB_TESTS_RUNTIME=On -DFLB_TESTS_INTERNAL=On
  • cmake --build build -j8 --target flb-plugin-in_node_exporter_metrics
  • cmake --build build -j8
  • Five-second node_exporter_metrics netstat smoke run against the host /proc; IPv4, TcpExt/IpExt, and IPv6 metrics were emitted.
  • Equivalent Valgrind smoke run: zero errors.
  • Full PR-range commit-prefix lint.
  • git diff --check

There is currently no node exporter pytest or CTest scenario in-tree for this compile-time regression.

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling when collecting network statistics from system metric files.
    • Preserved existing parsing behavior while making metric updates more reliable.

Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d0630a14-76d6-4a09-8c2c-db7350f9c5d5

📥 Commits

Reviewing files that changed from the base of the PR and between b2145cb and 8eb60f1.

📒 Files selected for processing (1)
  • plugins/in_node_exporter_metrics/ne_netstat_linux.c

📝 Walkthrough

Walkthrough

Updated netstat_update to assign return values when reading /net/netstat and /net/snmp6 through the configured procfs path. Existing parsing control flow remains unchanged.

Changes

Netstat procfs reads

Layer / File(s) Summary
Read netstat and snmp6 inputs
plugins/in_node_exporter_metrics/ne_netstat_linux.c
netstat_update assigns the results of both procfs file reads before applying the existing ret == 0 parsing logic.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Possibly related PRs

Suggested reviewers: cosmo0920

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Fix failing CI checks
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch in-node-exporter-read-lines-ci

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@edsiper
edsiper marked this pull request as ready for review July 29, 2026 17:43
@edsiper
edsiper requested a review from cosmo0920 as a code owner July 29, 2026 17:43
@edsiper
edsiper merged commit b8d983b into master Jul 29, 2026
49 of 51 checks passed
@edsiper edsiper added this to the Fluent Bit v5.1 milestone Jul 29, 2026
@edsiper
edsiper deleted the in-node-exporter-read-lines-ci branch July 29, 2026 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant