Update calls (*meminfoCollector).getMemInfo to get the platform specific memory metrics.
(ch chan<- prometheus.Metric)
| 45 | // Update calls (*meminfoCollector).getMemInfo to get the platform specific |
| 46 | // memory metrics. |
| 47 | func (c *meminfoCollector) Update(ch chan<- prometheus.Metric) error { |
| 48 | memInfo, err := c.getMemInfo() |
| 49 | if err != nil { |
| 50 | return fmt.Errorf("couldn't get meminfo: %s", err) |
| 51 | } |
| 52 | log.Debugf("set node_mem: %#v", memInfo) |
| 53 | for k, v := range memInfo { |
| 54 | ch <- prometheus.MustNewConstMetric( |
| 55 | prometheus.NewDesc( |
| 56 | prometheus.BuildFQName(namespace, memInfoSubsystem, k), |
| 57 | fmt.Sprintf("Memory information field %s.", k), |
| 58 | nil, nil, |
| 59 | ), |
| 60 | prometheus.GaugeValue, v, |
| 61 | ) |
| 62 | } |
| 63 | return nil |
| 64 | } |
| 65 | |
| 66 | func procFilePath(name string) string { |
| 67 | return path.Join(ProcPath, name) |
nothing calls this directly
no test coverage detected