MCPcopy
hub / github.com/prometheus/node_exporter / Update

Method Update

collector/bcache_linux.go:57–73  ·  view source on GitHub ↗

Update reads and exposes bcache stats. It implements the Collector interface.

(ch chan<- prometheus.Metric)

Source from the content-addressed store, hash-verified

55// Update reads and exposes bcache stats.
56// It implements the Collector interface.
57func (c *bcacheCollector) Update(ch chan<- prometheus.Metric) error {
58 var stats []*bcache.Stats
59 var err error
60 if *priorityStats {
61 stats, err = c.fs.Stats()
62 } else {
63 stats, err = c.fs.StatsWithoutPriority()
64 }
65 if err != nil {
66 return fmt.Errorf("failed to retrieve bcache stats: %w", err)
67 }
68
69 for _, s := range stats {
70 c.updateBcacheStats(ch, s)
71 }
72 return nil
73}
74
75type bcacheMetric struct {
76 name string

Callers

nothing calls this directly

Calls 2

updateBcacheStatsMethod · 0.95
StatsMethod · 0.65

Tested by

no test coverage detected