UpdateBcacheStats collects statistics for one bcache ID.
(ch chan<- prometheus.Metric, s *bcache.Stats)
| 152 | |
| 153 | // UpdateBcacheStats collects statistics for one bcache ID. |
| 154 | func (c *bcacheCollector) updateBcacheStats(ch chan<- prometheus.Metric, s *bcache.Stats) { |
| 155 | |
| 156 | const ( |
| 157 | subsystem = "bcache" |
| 158 | ) |
| 159 | |
| 160 | var ( |
| 161 | devLabel = []string{"uuid"} |
| 162 | allMetrics []bcacheMetric |
| 163 | metrics []bcacheMetric |
| 164 | ) |
| 165 | |
| 166 | allMetrics = []bcacheMetric{ |
| 167 | // metrics in /sys/fs/bcache/<uuid>/ |
| 168 | { |
| 169 | name: "average_key_size_sectors", |
| 170 | desc: "Average data per key in the btree (sectors).", |
| 171 | value: float64(s.Bcache.AverageKeySize), |
| 172 | metricType: prometheus.GaugeValue, |
| 173 | }, |
| 174 | { |
| 175 | name: "btree_cache_size_bytes", |
| 176 | desc: "Amount of memory currently used by the btree cache.", |
| 177 | value: float64(s.Bcache.BtreeCacheSize), |
| 178 | metricType: prometheus.GaugeValue, |
| 179 | }, |
| 180 | { |
| 181 | name: "cache_available_percent", |
| 182 | desc: "Percentage of cache device without dirty data, usable for writeback (may contain clean cached data).", |
| 183 | value: float64(s.Bcache.CacheAvailablePercent), |
| 184 | metricType: prometheus.GaugeValue, |
| 185 | }, |
| 186 | { |
| 187 | name: "congested", |
| 188 | desc: "Congestion.", |
| 189 | value: float64(s.Bcache.Congested), |
| 190 | metricType: prometheus.GaugeValue, |
| 191 | }, |
| 192 | { |
| 193 | name: "root_usage_percent", |
| 194 | desc: "Percentage of the root btree node in use (tree depth increases if too high).", |
| 195 | value: float64(s.Bcache.RootUsagePercent), |
| 196 | metricType: prometheus.GaugeValue, |
| 197 | }, |
| 198 | { |
| 199 | name: "tree_depth", |
| 200 | desc: "Depth of the btree.", |
| 201 | value: float64(s.Bcache.TreeDepth), |
| 202 | metricType: prometheus.GaugeValue, |
| 203 | }, |
| 204 | // metrics in /sys/fs/bcache/<uuid>/internal/ |
| 205 | { |
| 206 | name: "active_journal_entries", |
| 207 | desc: "Number of journal entries that are newer than the index.", |
| 208 | value: float64(s.Bcache.Internal.ActiveJournalEntries), |
| 209 | metricType: prometheus.GaugeValue, |
| 210 | }, |
| 211 | { |
no test coverage detected