Skip to content

Commit c1422c1

Browse files
lssystemstats collector to be forward compatible with new version of lssystemstats api (#21)
Signed-off-by: Mu Chen <[email protected]>
1 parent 6fd55a5 commit c1422c1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

collector/system_stats_collector.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,10 @@ func (c *systemStatsCollector) Collect(sClient utils.SpectrumClient, ch chan<- p
163163

164164
systemStats := gjson.Parse(systemStatsResp).Array()
165165
for i, systemStat := range systemStats {
166-
ch <- prometheus.MustNewConstMetric(metrics[i], prometheus.GaugeValue, systemStat.Get("stat_current").Float(), labelvalues...)
167-
166+
// ignore the fields greater than 49
167+
if i < 49 {
168+
ch <- prometheus.MustNewConstMetric(metrics[i], prometheus.GaugeValue, systemStat.Get("stat_current").Float(), labelvalues...)
169+
}
168170
}
169171
logger.Debugln("exit SystemStats collector")
170172
return nil

0 commit comments

Comments
 (0)