Skip to content

Commit 615a7dd

Browse files
authored
Merge pull request #9 from ZeeShen/fs
fix fs metrics npe
2 parents cb6971d + 215a329 commit 615a7dd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/org/compuscene/metrics/prometheus/PrometheusMetricsCollector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ private void updateFsMetrics(FsInfo fs) {
497497
catalog.setGauge("fs_total_total_bytes", fs.getTotal().getTotal().bytes(), node);
498498
catalog.setGauge("fs_total_available_bytes", fs.getTotal().getAvailable().bytes(), node);
499499
catalog.setGauge("fs_total_free_bytes", fs.getTotal().getFree().bytes(), node);
500-
if (fs.getTotal().getSpins() != null)
500+
if (fs.getTotal() != null && fs.getTotal().getSpins() != null)
501501
catalog.setGauge("fs_total_is_spinning_bool", fs.getTotal().getSpins() ? 1 : 0, node);
502502

503503
for (FsInfo.Path fspath : fs) {

0 commit comments

Comments
 (0)