Skip to content

Commit 2bbde6c

Browse files
committed
Fix metrics
1 parent 3668310 commit 2bbde6c

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

collector/nginx_plus.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,13 @@ func NewNginxPlusCollector(nginxClient *plusclient.NginxClient, namespace string
102102
"health_checks_unhealthy": newStreamUpstreamServerMetric(namespace, "health_checks_unhealthy", "How many times the server became unhealthy (state 'unhealthy')"),
103103
},
104104
streamZoneSyncMetrics: map[string]*prometheus.Desc{
105-
"bytes_in": newStreamZoneSyncMetric(namespace, "bytes_in", "Bytes received by this zone"),
106-
"bytes_out": newStreamZoneSyncMetric(namespace, "bytes_out", "Bytes sent by this zone"),
107-
"msgs_in": newStreamZoneSyncMetric(namespace, "msgs_in", "Total messages received by ths zone"),
108-
"msgs_out": newStreamZoneSyncMetric(namespace, "msgs_out", "Total messages sent by this zone"),
105+
"bytes_in": newStreamZoneSyncMetric(namespace, "bytes_in", "Bytes received by this node"),
106+
"bytes_out": newStreamZoneSyncMetric(namespace, "bytes_out", "Bytes sent by this node"),
107+
"msgs_in": newStreamZoneSyncMetric(namespace, "msgs_in", "Total messages received by this node"),
108+
"msgs_out": newStreamZoneSyncMetric(namespace, "msgs_out", "Total messages sent by this node"),
109109
"nodes_online": newStreamZoneSyncMetric(namespace, "nodes_online", "Number of peers this node is conected to"),
110-
"records_pending": newStreamZoneSyncZonesMetric(namespace, "records_pending", "The number of records that need to be sent to the cluster"),
111-
"records_total": newStreamZoneSyncZonesMetric(namespace, "records_total", "The total number of records stored in the shared memory zone"),
110+
"records_pending": newStreamZoneSyncZoneMetric(namespace, "records_pending", "The number of records that need to be sent to the cluster"),
111+
"records_total": newStreamZoneSyncZoneMetric(namespace, "records_total", "The total number of records stored in the shared memory zone"),
112112
},
113113
upMetric: newUpMetric(namespace),
114114
}
@@ -305,9 +305,9 @@ func (c *NginxPlusCollector) Collect(ch chan<- prometheus.Metric) {
305305

306306
for name, zone := range stats.StreamZoneSync.Zones {
307307
ch <- prometheus.MustNewConstMetric(c.streamZoneSyncMetrics["records_pending"],
308-
prometheus.CounterValue, float64(zone.RecordsPending), name)
308+
prometheus.GaugeValue, float64(zone.RecordsPending), name)
309309
ch <- prometheus.MustNewConstMetric(c.streamZoneSyncMetrics["records_total"],
310-
prometheus.CounterValue, float64(zone.RecordsTotal), name)
310+
prometheus.GaugeValue, float64(zone.RecordsTotal), name)
311311
}
312312

313313
ch <- prometheus.MustNewConstMetric(c.streamZoneSyncMetrics["bytes_in"],
@@ -319,7 +319,7 @@ func (c *NginxPlusCollector) Collect(ch chan<- prometheus.Metric) {
319319
ch <- prometheus.MustNewConstMetric(c.streamZoneSyncMetrics["msgs_out"],
320320
prometheus.CounterValue, float64(stats.StreamZoneSync.Status.MsgsOut))
321321
ch <- prometheus.MustNewConstMetric(c.streamZoneSyncMetrics["nodes_online"],
322-
prometheus.CounterValue, float64(stats.StreamZoneSync.Status.NodesOnline))
322+
prometheus.GaugeValue, float64(stats.StreamZoneSync.Status.NodesOnline))
323323
}
324324

325325
var upstreamServerStates = map[string]float64{
@@ -359,6 +359,6 @@ func newStreamZoneSyncMetric(namespace string, metricName string, docString stri
359359
return prometheus.NewDesc(prometheus.BuildFQName(namespace, "stream_zone_sync_status", metricName), docString, nil, nil)
360360
}
361361

362-
func newStreamZoneSyncZonesMetric(namespace string, metricName string, docString string) *prometheus.Desc {
363-
return prometheus.NewDesc(prometheus.BuildFQName(namespace, "stream_zone_sync", metricName), docString, []string{"server_zone"}, nil)
362+
func newStreamZoneSyncZoneMetric(namespace string, metricName string, docString string) *prometheus.Desc {
363+
return prometheus.NewDesc(prometheus.BuildFQName(namespace, "stream_zone_sync_zone", metricName), docString, []string{"zone"}, nil)
364364
}

0 commit comments

Comments
 (0)