You've already forked nginx_exporter
mirror of
https://github.com/nginxinc/nginx-prometheus-exporter.git
synced 2025-08-05 06:41:09 +03:00
Add const labels to upMetric
This commit is contained in:
committed by
Dean Coakley
parent
39585bd443
commit
6a9964bcce
@@ -11,11 +11,12 @@ func newGlobalMetric(namespace string, metricName string, docString string, cons
|
||||
return prometheus.NewDesc(namespace+"_"+metricName, docString, nil, constLabels)
|
||||
}
|
||||
|
||||
func newUpMetric(namespace string) prometheus.Gauge {
|
||||
func newUpMetric(namespace string, constLabels map[string]string) prometheus.Gauge {
|
||||
return prometheus.NewGauge(prometheus.GaugeOpts{
|
||||
Namespace: namespace,
|
||||
Name: "up",
|
||||
Help: "Status of the last metric scrape",
|
||||
ConstLabels: constLabels,
|
||||
})
|
||||
}
|
||||
|
||||
|
@@ -29,7 +29,7 @@ func NewNginxCollector(nginxClient *client.NginxClient, namespace string, constL
|
||||
"connections_waiting": newGlobalMetric(namespace, "connections_waiting", "Idle client connections", constLabels),
|
||||
"http_requests_total": newGlobalMetric(namespace, "http_requests_total", "Total http requests", constLabels),
|
||||
},
|
||||
upMetric: newUpMetric(namespace),
|
||||
upMetric: newUpMetric(namespace, constLabels),
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -136,7 +136,7 @@ func NewNginxPlusCollector(nginxClient *plusclient.NginxClient, namespace string
|
||||
"timedout": newResolverMetric(namespace, "timedout", "Total number of timed out requests", constLabels),
|
||||
"unknown": newResolverMetric(namespace, "unknown", "Total requests completed with an unknown error", constLabels),
|
||||
},
|
||||
upMetric: newUpMetric(namespace),
|
||||
upMetric: newUpMetric(namespace, constLabels),
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user