1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
Description: Avoid panic when replStats.PreloadStats is nil.
Author: Steffen Prohaska <prohaska@zib.de>
Forwarded: https://github.com/dcu/mongodb_exporter/issues/110
Index: prometheus-mongodb-exporter/collector/metrics.go
===================================================================
--- prometheus-mongodb-exporter.orig/collector/metrics.go
+++ prometheus-mongodb-exporter/collector/metrics.go
@@ -349,7 +349,9 @@ func (replStats *ReplStats) Export(ch ch
replStats.Apply.Export(ch)
replStats.Buffer.Export(ch)
replStats.Network.Export(ch)
- replStats.PreloadStats.Export(ch)
+ if replStats.PreloadStats != nil {
+ replStats.PreloadStats.Export(ch)
+ }
}
// PreloadStats are the stats associated with preload operation.
|