Skip to content

Commit

Permalink
change nats_up to gauge
Browse files Browse the repository at this point in the history
Signed-off-by: Caleb Lloyd <[email protected]>
  • Loading branch information
Caleb Lloyd committed Mar 7, 2024
1 parent d7b2969 commit e8ca94f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions surveyor/collector_statz.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ func (sc *StatzCollector) buildDescs() {

// A unlabelled description for the up/down
sc.natsUp = prometheus.NewDesc(prometheus.BuildFQName("nats", "core", "nats_up"),
"1 if connected to NATS, 0 otherwise. A counter.", nil, sc.constLabels)
"1 if connected to NATS, 0 otherwise. A gauge.", nil, sc.constLabels)

sc.descs.Info = newPromDesc("info", "General Server information Summary gauge", sc.serverInfoLabels)
sc.descs.Start = newPromDesc("start_time", "Server start time gauge", sc.serverLabels)
Expand Down Expand Up @@ -928,15 +928,15 @@ func (sc *StatzCollector) Collect(ch chan<- prometheus.Metric) {
if err := sc.poll(); err != nil {
sc.logger.Warnf("Error polling NATS server: %v", err)
sc.pollErrCnt.WithLabelValues().Inc()
metrics.newCounterMetric(sc.natsUp, 0, nil)
metrics.newGaugeMetric(sc.natsUp, 0, nil)
return metrics.metrics, nil
}

// lock the stats
sc.Lock()
defer sc.Unlock()

metrics.newCounterMetric(sc.natsUp, 1, nil)
metrics.newGaugeMetric(sc.natsUp, 1, nil)
sc.surveyedCnt.WithLabelValues().Set(0)

for _, sm := range sc.stats {
Expand Down

0 comments on commit e8ca94f

Please sign in to comment.