qnapexporter
qnapexporter copied to clipboard
fix: allocationToken out of range
Fix the issue of different data being read when executing dmsetup status --noflush
on different devices, leading to a panic error.
panic: runtime error: index out of range [1] with length 1
goroutine 124 [running]:
github.com/pedropombeiro/qnapexporter/lib/exporter/prometheus.(*promExporter).getDmCacheStatsMetrics(0xc000320540)
/github/workspace/lib/exporter/prometheus/disk.go:108 +0x545
github.com/pedropombeiro/qnapexporter/lib/exporter/prometheus.fetchMetricsWorker(0x0?, 0x0?, 0xd, 0x0?)
/github/workspace/lib/exporter/prometheus/prometheus.go:166 +0x78
created by github.com/pedropombeiro/qnapexporter/lib/exporter/prometheus.(*promExporter).WriteMetrics
/github/workspace/lib/exporter/prometheus/prometheus.go:126 +0x1fc
I have only tested it on my device, and it works well. Currently, the unhandled logic is for cases where the string divided by '/' does not exist, but this problem probably won't occur. 🤔
Device: TS-464c
close #3