-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Description
https://github.com/prometheus/node_exporter/blob/master/collector/tcpstat_linux.go#L116
Please read /proc/net files with a single read syscall.
`for scanner.Scan() {
parts := strings.Fields(scanner.Text())
if len(parts) == 0 {
continue
}
if len(parts) < 4 {
return nil, fmt.Errorf("invalid TCP stats line: %q", scanner.Text())
}
if strings.HasPrefix(parts[0], "sl") {
continue
}
st, err := strconv.ParseInt(parts[3], 16, 8)
if err != nil {
return nil, err
}
tcpStats[tcpConnectionState(st)]++
}`
which maybe lead high memory usage
Reactions are currently unavailable