HewlettPackard / lustre_exporter

Prometheus exporter for use with the Lustre parallel filesystem
Apache License 2.0
36 stars 51 forks source link

try fixing errors occured caused by jobid parsing failed, a dot may not exist when a jobid consists of both characters and numbers #149

Closed ziyht closed 2 years ago

ziyht commented 5 years ago

we found a bug when pasing jobid, it will make luster_exporter not collect data correctlly, errs occurd:

ERRO[0723] error gathering metrics: 18 error(s) occurred:


we can see the jobid is empty, so I did some tests and found those above errs will occured when jobid source string is in next cases:

"job_id: loop1500" "job_id: loop1400"


new test added for procfs_test.go: TestGetJobNum()

testString = "job_id: loop1500" expected = "loop1500"


[ziyht@localhost lustre_exporter]$ make

formatting code linting code building binaries lustre_exporter running tests ok github.com/HewlettPackard/lustre_exporter (cached)

--- FAIL: TestGetJobNum (0.00s) procfs_test.go:62: Retrieved an unexpected Job ID. Expected: loop1500, Got: FAIL FAIL github.com/HewlettPackard/lustre_exporter/sources 0.006s make: *** [test] 错误 1