Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allocationToken out of range #4

Conversation

SkyeYoung
Copy link
Contributor

@SkyeYoung SkyeYoung commented Jan 21, 2024

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. 馃

image

Device: TS-464c

close #3

@pedropombeiro pedropombeiro force-pushed the master branch 2 times, most recently from 11e9be2 to 50b332c Compare July 7, 2024 21:31
@pedropombeiro pedropombeiro merged commit 3d04385 into pedropombeiro:master Jul 7, 2024
@pedropombeiro
Copy link
Owner

Thanks for submitting this fix, @SkyeYoung! I missed the notification, sorry about the long wait!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

crash on TS-264
2 participants