[Metricbeat] add a network_summary metricset #15196
[Metricbeat] add a network_summary metricset #15196fearful-symmetry merged 24 commits intoelastic:masterfrom
Conversation
|
jenkins, test this |
efa7888 to
0568dd5
Compare
|
I believe it is going to be fixed by this PR: #15265 |
| } | ||
|
|
||
| // combineMap concatinates two given maps | ||
| func combineMap(map1, map2 map[string]int64) map[string]int64 { |
There was a problem hiding this comment.
Is there any designated utils package for such functions?
There was a problem hiding this comment.
I don't think I could find any, but someone else might know.
There was a problem hiding this comment.
This looks a lot like:
beats/libbeat/common/mapstr.go
Lines 270 to 284 in c115bb1
There was a problem hiding this comment.
So, considering that takes a MapStr and I have a map[string]int64 I'm not sure whatever memory/performance overhead of copying/casting is worth it.
There was a problem hiding this comment.
The memory layout for MapStr would be quite different and we currently have no functions to convert any type into MapStr (in the filebeat-new-registry-file feature branch we have some functionality that can convert between abritrary types). We do not have a designated package for custom map types. Plus MapStr would be a little overkill here.
It's tempting to have a package dealing with common cases in the future once we have generics :), but I'm not keen to use tools that rely on code generation (unless it's very local in another package).
How much of a problem is this in metricbeat? Do we have 10+ modules repeating this piece of code, or is it the first one we ever need this?
If it is no "real" problem, I'd rather keep this function here as is. Small optimization tip: var compMap = make(map[string]int64, len(map1) + len(map2)).
If we find this to be a real problem, we should discuss it again in a broader context.
|
netstat -su What info would you gather from netstat? It would be really nice to be able to graph udp: In order to troubleshoot udp performance issues on Logstash. |
mtojek
left a comment
There was a problem hiding this comment.
Thank you for addressing all comments. If there are no more comments, feel free to ship it!
| "system": { | ||
| "network_summary": { | ||
| "icmp": { | ||
| "InAddrMaskReps": 0, |
There was a problem hiding this comment.
is it common practice in metricbeat to use camel case for a set of 'undocumented' metrics? Do we want to convert to snake case (e.g. github.com/stoewer/go-strcase).
There was a problem hiding this comment.
So, my thinking was that since we're inserting "blind" metrics with no real opinionated manipulating of the data, keeping the key values the same as the their OS values might be a good idea. Let me hunt around the system module to see if we do this in other places.
There was a problem hiding this comment.
We have done this when ingesting metrics in raw from a source, to avoid confusion. AWS cloudwatch is an example. That said, I don't have a strong opinion here
| compMap[k] = checkMaxConn(k, v) | ||
| } | ||
| return compMap | ||
| } |
There was a problem hiding this comment.
Now we've got a type similar to common.MapStr. Consider to split normalizing and merging into separate functions like:
func combineMap(m1, m2 map[string]uint64) common.MapStr {
return common.MapStrUnion(normalizeMap(m1), normalizeMap(m2))
}
func normalizeMap(m map[string]uint64) common.MapStr {
to := common.MapStr{}
for k, v := range {
to[k] = normalize(k, v)
}
return to
}
func normalize(k string, v uint64) interface{} {
if k == "MacConn" {
return int64(v)
}
return v
}
* commit of system/network_summary (cherry picked from commit 8b9ffbd)
|
Missing from reference config: #15637 |
See #12210
This adds a new
systemmetricset,network_summary, that reports global network counters under Linux. This is a fairly small code addition, as most of the complexity is ingo-sysinfo. The large diff is because we need to updatego-sysinfo, and alsogolang.org/x/sysdue to this: elastic/go-sysinfo#67This is a draft as there's two things we need to sort out:
netstat -sdoes things, and how the raw data coming off of/proc/net/{snmp,netstat}is shown.netstatprovides human-readable descriptions and key values, but the actual counters that we get are hard-coded, meaning we don't get 100% of the data the kernel presents. On the other side, the/proc/netdata is complete, but the key values aren't particularly helpful. My philosophy was that we should present as much of the data as we can get in a mapping that's reasonably intuitive, and then maybe provide a dashboard to make the data more human-readableTest plan:
_meta/data.json