fix(host_metrics source): fix tcp netlink bug#24441
fix(host_metrics source): fix tcp netlink bug#24441thomasqueirozb merged 4 commits intovectordotdev:masterfrom
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
|
hmm i guess i have to split this into 2 prs - will do in a bit |
|
looks like grafana is interpreting the new inode metrics as counters for some reason, will double check the format in a bit |
d7bf682 to
aa4e264
Compare
…aders add netlink to allowed words list
aa4e264 to
f9138ac
Compare
|
Have now split the inodes bit onto another branch which i will PR separately. |
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) |
thomasqueirozb
left a comment
There was a problem hiding this comment.
Very nice, thanks!
src/sources/host_metrics/tcp.rs
Outdated
| if done { | ||
| break; | ||
| loop { | ||
| match socket.recv_from_full().await { |
There was a problem hiding this comment.
socket.recv doesn't return how many bytes were read. Although now we'll probably pay the cost of allocation a Vec<u8> every time it should still be better than what we had previously
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 byteswere actually received.
changed to use
socket.recv_from_full()which returnsVec<u8>containing onlythe actual received bytes.
Vector configuration
How did you test this PR?
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
Is this a breaking change?
Does this PR include user facing changes?
guidelines.
no-changeloglabel to this PR.References
Files Changed
src/sources/host_metrics/tcp.rs- fixed netlink receive to userecv_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.