@@ -303,23 +303,25 @@ func (c *NginxPlusCollector) Collect(ch chan<- prometheus.Metric) {
303
303
prometheus .GaugeValue , float64 (upstream .Zombies ), name )
304
304
}
305
305
306
- for name , zone := range stats .StreamZoneSync .Zones {
307
- ch <- prometheus .MustNewConstMetric (c .streamZoneSyncMetrics ["records_pending" ],
308
- prometheus .GaugeValue , float64 (zone .RecordsPending ), name )
309
- ch <- prometheus .MustNewConstMetric (c .streamZoneSyncMetrics ["records_total" ],
310
- prometheus .GaugeValue , float64 (zone .RecordsTotal ), name )
311
- }
306
+ if stats .StreamZoneSync != nil {
307
+ for name , zone := range stats .StreamZoneSync .Zones {
308
+ ch <- prometheus .MustNewConstMetric (c .streamZoneSyncMetrics ["records_pending" ],
309
+ prometheus .GaugeValue , float64 (zone .RecordsPending ), name )
310
+ ch <- prometheus .MustNewConstMetric (c .streamZoneSyncMetrics ["records_total" ],
311
+ prometheus .GaugeValue , float64 (zone .RecordsTotal ), name )
312
+ }
312
313
313
- ch <- prometheus .MustNewConstMetric (c .streamZoneSyncMetrics ["bytes_in" ],
314
- prometheus .CounterValue , float64 (stats .StreamZoneSync .Status .BytesIn ))
315
- ch <- prometheus .MustNewConstMetric (c .streamZoneSyncMetrics ["bytes_out" ],
316
- prometheus .CounterValue , float64 (stats .StreamZoneSync .Status .BytesOut ))
317
- ch <- prometheus .MustNewConstMetric (c .streamZoneSyncMetrics ["msgs_in" ],
318
- prometheus .CounterValue , float64 (stats .StreamZoneSync .Status .MsgsIn ))
319
- ch <- prometheus .MustNewConstMetric (c .streamZoneSyncMetrics ["msgs_out" ],
320
- prometheus .CounterValue , float64 (stats .StreamZoneSync .Status .MsgsOut ))
321
- ch <- prometheus .MustNewConstMetric (c .streamZoneSyncMetrics ["nodes_online" ],
322
- prometheus .GaugeValue , float64 (stats .StreamZoneSync .Status .NodesOnline ))
314
+ ch <- prometheus .MustNewConstMetric (c .streamZoneSyncMetrics ["bytes_in" ],
315
+ prometheus .CounterValue , float64 (stats .StreamZoneSync .Status .BytesIn ))
316
+ ch <- prometheus .MustNewConstMetric (c .streamZoneSyncMetrics ["bytes_out" ],
317
+ prometheus .CounterValue , float64 (stats .StreamZoneSync .Status .BytesOut ))
318
+ ch <- prometheus .MustNewConstMetric (c .streamZoneSyncMetrics ["msgs_in" ],
319
+ prometheus .CounterValue , float64 (stats .StreamZoneSync .Status .MsgsIn ))
320
+ ch <- prometheus .MustNewConstMetric (c .streamZoneSyncMetrics ["msgs_out" ],
321
+ prometheus .CounterValue , float64 (stats .StreamZoneSync .Status .MsgsOut ))
322
+ ch <- prometheus .MustNewConstMetric (c .streamZoneSyncMetrics ["nodes_online" ],
323
+ prometheus .GaugeValue , float64 (stats .StreamZoneSync .Status .NodesOnline ))
324
+ }
323
325
}
324
326
325
327
var upstreamServerStates = map [string ]float64 {
0 commit comments