in pkg/metrics/collector/sockstat.go [168:186]
func (c *sockStatCollector) Update(ch chan<- prometheus.Metric) error {
ss, err := getSockStats(procFilePath("net/sockstat"))
if err != nil {
return err
}
ss6, err := getSockStats(procFilePath("net/sockstat6"))
if err != nil {
return err
}
ch <- prometheus.MustNewConstMetric(socketInUseDesc, prometheus.GaugeValue, float64(ss.tcpInUse+ss6.tcpInUse), "tcp")
ch <- prometheus.MustNewConstMetric(socketInUseDesc, prometheus.GaugeValue, float64(ss.udpInUse+ss6.udpInUse), "udp")
// sockstat6 file doesn't have tcp tw stats
ch <- prometheus.MustNewConstMetric(socketTimeWaitDesc, prometheus.GaugeValue, float64(ss.tcpTimeWait))
// sockstat6 file doesn't have mem stats
ch <- prometheus.MustNewConstMetric(socketMemoryDesc, prometheus.GaugeValue, float64(ss.memUsedInPages*uint64(pageSize)))
return nil
}