Skip to content

fix(procfs): report raw values in parse errors#841

Merged
SuperQ merged 1 commit into
prometheus:masterfrom
HNO3Miracle:fix-parse-error-format-strings
Jul 17, 2026
Merged

fix(procfs): report raw values in parse errors#841
SuperQ merged 1 commit into
prometheus:masterfrom
HNO3Miracle:fix-parse-error-format-strings

Conversation

@HNO3Miracle

@HNO3Miracle HNO3Miracle commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • report the original mountinfo field when mount or parent IDs cannot be parsed
  • report the original network socket field for sequence, port, state, queue, UID, inode, and drop parsing failures
  • add regression coverage for every corrected error path

Why

The existing errors format the parsed integer destination, which is zero-valued when parsing fails. This hides the malformed input from callers. Go 1.26.4 also reports these remaining integer arguments as invalid for the %q format verb during downstream package tests.

This follows up on #832, which fixed the same pattern in net_wireless.go, nfs/parse.go, and proc_cgroup.go but did not cover mountinfo.go or net_ip_socket.go.

Testing

  • make test
  • make lint

Use the original string fields when reporting mountinfo and network socket parsing failures. The parsed integer destinations are zero-valued on errors and hide the malformed input.

Signed-off-by: HNO3Miracle <xiangao.or@isrc.iscas.ac.cn>

@SuperQ SuperQ left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@SuperQ
SuperQ merged commit de79070 into prometheus:master Jul 17, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants