-
Notifications
You must be signed in to change notification settings - Fork 355
Added parsing netfilter conntrack statistics from net/stat/nf_conntrack #254
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
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.
Looks good, thanks for the contribution! Just had a few minor comments in-line.
net_conntrackstat.go
Outdated
| // A ConntrackStatEntry represents one line from net/stat/nf_conntrack | ||
| // and contains netfilter conntrack statistics at one CPU core | ||
| type ConntrackStatEntry struct { | ||
| CPU int |
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 CPU necessary here? Seems like this can be determined by the location in the slice.
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.
Yeah, probably this is excessive, removed it.
net_conntrackstat.go
Outdated
| @@ -0,0 +1,154 @@ | |||
| // Copyright 2019 The Prometheus Authors | |||
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.
Should be 2020
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.
Fixed
net_conntrackstat_test.go
Outdated
| @@ -0,0 +1,89 @@ | |||
| // Copyright 2018 The Prometheus Authors | |||
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.
Should be 2020
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.
Fixed
|
Fixes #217 |
| } | ||
|
|
||
| // Parses a ConntrackStatEntry from given array of fields | ||
| func parseConntrackStatEntry(fields []string) (*ConntrackStatEntry, 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.
Check for length of fields to prevent a runtime panic.
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.
Added
|
Thanks for the update, looks like the new commit doesn't have a signoff, you can either squash it into the first commit, or do a |
5089553 to
018e4fe
Compare
Signed-off-by: Aleksandr Kozlov <[email protected]>
018e4fe to
2285920
Compare
👌 |
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
Added parsing netfilter conntrack statistics from net/stat/nf_conntrack
Added parsing of conntrack statistics from procfs for this PR in node_exporter project: prometheus/node_exporter#1155
@discordianfish please review