Skip to content

Conversation

@mushrowan
Copy link

@mushrowan mushrowan commented Jan 3, 2026

Summary

fix tcp metrics netlink parsing error (#22487)

fixes the "Could not parse netlink response: Decode error occurred: invalid
netlink buffer" error that occurs when collecting tcp metrics. this was caused
by socket.recv() with a fixed 4096 byte buffer but didn't track how many bytes
were actually received.

changed to use socket.recv_from_full() which returns Vec<u8> containing only
the actual received bytes.

Vector configuration

[sources.host_metrics]
type = "host_metrics"
collectors = ["network"] # for tcp

How did you test this PR?

# run tcp metrics tests (including ignored integration test)
cargo test -p vector --no-default-features --features sources-host_metrics tcp -- --include-ignored

all tests pass. Have also made a docker image @ tocalabs0509/vector:dev, which
works including the new bits. Note that it's a nix container I made for
testing just these changes, so other stuff e.g. journald doesn't work on it, but
should work in the final image.

Change Type

  • Bug fix
  • New feature
  • Non-functional (chore, refactoring, docs)
  • Performance

Is this a breaking change?

  • Yes
  • No

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on our
    guidelines.
  • No. A maintainer will apply the no-changelog label to this PR.

References

Files Changed

  • src/sources/host_metrics/tcp.rs - fixed netlink receive to use
    recv_from_full()

Extra note

I was building this on my system using Nix, for which I wrote a flake.nix. I
assumed that people wouldn't want a flake.nix and flake.lock clogging up the
root of the repo so I haven't included it, but if this is wanted I'm happy to
add to the PR.
https://github.com/mushrowan/vector-flake in case you want to look.

@mushrowan mushrowan requested a review from a team as a code owner January 3, 2026 16:06
@github-actions github-actions bot added the domain: sources Anything related to the Vector's sources label Jan 3, 2026
@github-actions
Copy link

github-actions bot commented Jan 3, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@mushrowan
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

@mushrowan
Copy link
Author

hmm i guess i have to split this into 2 prs - will do in a bit

@mushrowan
Copy link
Author

looks like grafana is interpreting the new inode metrics as counters for some reason, will double check the format in a bit

@mushrowan mushrowan changed the title feat+fix(host_metrics source): add filesystem inode metrics & fix tcp netlink bug fix(host_metrics source): fix tcp netlink bug Jan 8, 2026
@github-actions github-actions bot added the domain: ci Anything related to Vector's CI environment label Jan 8, 2026
@mushrowan
Copy link
Author

Have now split the inodes bit onto another branch which i will PR separately.

@mushrowan
Copy link
Author

looks like grafana is interpreting the new inode metrics as counters for some reason, will double check the format in a bit

I think this is just grafana getting confused when you only have one host with a metric and the metric keeps going up. the format of the JSON is fine by the looks of it - i suspect the warning will disappear once you have more than one host (warning also doesn't appear on the inode ratio)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: ci Anything related to Vector's CI environment domain: sources Anything related to the Vector's sources

Projects

None yet

Development

Successfully merging this pull request may close these issues.

host_metrics - linux - Invalid netlink buffer length

1 participant