MCPcopy Create free account
hub / github.com/CovenantSQL/CovenantSQL / Update

Method Update

metric/meminfo.go:47–64  ·  view source on GitHub ↗

Update calls (*meminfoCollector).getMemInfo to get the platform specific memory metrics.

(ch chan<- prometheus.Metric)

Source from the content-addressed store, hash-verified

45// Update calls (*meminfoCollector).getMemInfo to get the platform specific
46// memory metrics.
47func (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
66func procFilePath(name string) string {
67 return path.Join(ProcPath, name)

Callers

nothing calls this directly

Calls 3

getMemInfoMethod · 0.95
DebugfFunction · 0.92
ErrorfMethod · 0.80

Tested by

no test coverage detected