Update reads and exposes bcache stats. It implements the Collector interface.
(ch chan<- prometheus.Metric)
| 55 | // Update reads and exposes bcache stats. |
| 56 | // It implements the Collector interface. |
| 57 | func (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 | |
| 75 | type bcacheMetric struct { |
| 76 | name string |
nothing calls this directly
no test coverage detected