-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add parsing /proc/net/snmp6 file for netstat-linux #615
Conversation
Please add a sample data file to the |
collector/netstat_linux.go
Outdated
return parseSNMP6Stats(file, fileName) | ||
} | ||
|
||
func parseSNMP6Stats(r io.Reader, fileName string) (map[string]map[string]string, error) { |
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.
fileName
isn't actually used in this function.
collector/netstat_linux.go
Outdated
|
||
for scanner.Scan() { | ||
stat := strings.Fields(scanner.Text()) | ||
protocol := stat[0][:strings.Index(stat[0], "6") + 1] |
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.
You'll want to do bounds-checks on all of these slice index accesses.
collector/netstat_linux.go
Outdated
stat := strings.Fields(scanner.Text()) | ||
protocol := stat[0][:strings.Index(stat[0], "6") + 1] | ||
name := stat[0][strings.Index(stat[0], "6") + 1:] | ||
if _, present := netStats[protocol]; ! present { |
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.
Looks like this isn't gofmt
'd.
collector/fixtures/e2e-output.txt
Outdated
# HELP node_netstat_Ip6_InECT1Pkts Protocol Ip6 statistic InECT1Pkts. | ||
# TYPE node_netstat_Ip6_InECT1Pkts untyped | ||
node_netstat_Ip6_InECT1Pkts 0 | ||
# HELP node_netstat_Ip6_InHdrErrors Protocol Ip6 statistic InHdrErrors. |
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.
This is Ip6InHdrErrors, and I believe keeping the name together would make it easier for users to search for it online.
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.
This format is the same as previews stats.
Have different naming convention among the same module will be very confusing.
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.
The other source files are formatted differently. Most of these are obscure kernel stats that if you're lucky are mentioned on LKML somewhere, so keeping the original names increases the chances the users can find what little information there is about these stats.
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.
Is it ok if I change description to this format?
# HELP node_netstat_Ip6_InHdrErrors Statistic Ip6InHdrErrors.
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.
I think that'd be okay. These sort of metrics are always a tradeoff.
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
LGTM as well. |
* Add parsing /proc/net/snmp6 file * add /proc/net/snmp6 fixture * fix e2e test * gofmt * remove unuser variable * safe checks * add tests * change help format
Signed-off-by: prombot <prometheus-team@googlegroups.com>
No description provided.