-
Notifications
You must be signed in to change notification settings - Fork 323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix bug when /proc/net/dev contains unexpected line #421
fix bug when /proc/net/dev contains unexpected line #421
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting.. well the actual problem is that this assumes a device name can't include :
: https://github.com/prometheus/procfs/pull/421/files#diff-a691799f566ae988549d796fb8df91095344d63552424e79c7687a14dcaaf601R92
But we shouldn't just ignore parse errors. Instead, if we want to fix that, we need to parse this differently.
Thanks! Can you also add test cases for dev names that include :? |
@discordianfish hello! 🙇🏻♂️ Do I need to add more test cases? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
you need to sign your commit though before we can merge. See the DCO check |
Signed-off-by: 吴家榜 <[email protected]>
Signed-off-by: 吴家榜 <[email protected]>
Signed-off-by: 吴家榜 <[email protected]>
f44e864
to
38346fe
Compare
I have signed my commits. |
We should probably fix this the same way we fixed it in the node_exporter. I forgot we have yet to convert the node_exporter to this parser. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I like this better, it avoids use of regexp.
* fix bug when /proc/net/dev contains unexpected line Signed-off-by: 吴家榜 <[email protected]> * modifying netDev.parseLine due to odd interface name Signed-off-by: 吴家榜 <[email protected]> * adding testing case for net device that has colon in its name Signed-off-by: 吴家榜 <[email protected]> Co-authored-by: wujiabang <[email protected]> Co-authored-by: 吴家榜 <[email protected]>
* fix bug when /proc/net/dev contains unexpected line Signed-off-by: 吴家榜 <[email protected]> * modifying netDev.parseLine due to odd interface name Signed-off-by: 吴家榜 <[email protected]> * adding testing case for net device that has colon in its name Signed-off-by: 吴家榜 <[email protected]> Co-authored-by: wujiabang <[email protected]> Co-authored-by: 吴家榜 <[email protected]>
In centos 8(4.18.0-193.28.1.el8_2.x86_64) if I try this command:
I will get a message:
However if I do the same thing on Centos 7(3.10.0-862.14.4.el7.x86_64), there is no error ! And If I cat /proc/net/dev I can see there is a sub interface:
So the problem is currently 'procfs' cann't parse /proc/net/dev that contains odd line of interfaces.