-
Notifications
You must be signed in to change notification settings - Fork 24
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 per-process network stats #62
Add per-process network stats #62
Conversation
for k, v := range map1 { | ||
compMap[k] = checkMaxConn(k, v) | ||
} | ||
for k, v := range map2 { | ||
compMap[k] = checkMaxConn(k, v) | ||
} |
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.
what if 2 maps have the same key, do we check twice?
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.
So, these values are only being merged across a given protocol, and in my experience, the kernel won't report the same metric for a given protocol twice, so it should be fine? Not sure how we would recover from that anyway, since it would seemingly be the same metric reported in two different places?
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 just realised that checkMaxConn
would just do a type cast, it's not really a big deal to run it twice for the same key. So, the current logic is that the second map has a priority over the first if the keys collide, which I think is fine.
for k, v := range map1 { | ||
compMap[k] = checkMaxConn(k, v) | ||
} | ||
for k, v := range map2 { | ||
compMap[k] = checkMaxConn(k, v) | ||
} |
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 just realised that checkMaxConn
would just do a type cast, it's not really a big deal to run it twice for the same key. So, the current logic is that the second map has a priority over the first if the keys collide, which I think is fine.
What does this PR do?
This is one half of elastic/beats#7461
This adds per-process network stats on linux, taken from
/proc/PID/net/netstat
and/proc/PID/net/SNMP
.These metrics are the same kind used in the docker module for reporting docker network summary data.
This also includes a filter function, since all the data in the aforementioned two procfs files includes a prodigious amount of metrics.
There's a notable limitation here, which is that the procfs handler we're importing from
go-sysinfo
can't handle an alternate procfs.Why is it important?
This is an asked-for feature.
Checklist
CHANGELOG.md