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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

long node name causes index out of range error #80

Open
hokiegeek2 opened this issue May 23, 2022 · 1 comment
Open

long node name causes index out of range error #80

hokiegeek2 opened this issue May 23, 2022 · 1 comment

Comments

@hokiegeek2
Copy link

First of all, great project! This works great.

Found one easily fixable issue. If the node names are too long, the memoryAlloc field value merges into the node name value:

INFO[0000] Starting Server: 0.0.0.0:9090                 source="main.go:59"
INFO[0000] GPUs Accounting: false                        source="main.go:60"
INFO[0049] sinfo fields: [production-slurm-compute-10 8192 0/4/0/4 idle]  source="node.go:55"
panic: runtime error: index out of range [4] with length 4

goroutine 39 [running]:
main.ParseNodeMetrics({0xc0001b9000, 0x594, 0xc0000adde0?})
	/home/jyost/development/git/prometheus-slurm-exporter/node.go:58 +0x5a5
main.NodeGetMetrics()
	/home/jyost/development/git/prometheus-slurm-exporter/node.go:41 +0x1e
main.(*NodeCollector).Collect(0xc00007f740, 0xc0000adf60?)
	/home/jyost/development/git/prometheus-slurm-exporter/node.go:131 +0x3e
github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func1()
	/home/jyost/development/git/prometheus-slurm-exporter/go/modules/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:443 +0xfb
created by github.com/prometheus/client_golang/prometheus.(*Registry).Gather
	/home/jyost/development/git/prometheus-slurm-exporter/go/modules/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:535 +0xb0b

The node name is production-slurm-compute-1 and the 0 got appended to the end of the node name. I fixed in my fork and will submit a PR soon

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

No branches or pull requests

1 participant