Use Gauge instead of Counter for connections_active Prometheus metric
This commit is contained in:
parent
213b8c8267
commit
13d0f0ddab
2 changed files with 13 additions and 15 deletions
|
|
@ -89,7 +89,7 @@ func NewNGINXStatus(podName, namespace, ingressClass string) (NGINXStatusCollect
|
|||
p.data = &nginxStatusData{
|
||||
connectionsTotal: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(PrometheusNamespace, subSystem, "connections_total"),
|
||||
"total number of connections with state {active, accepted, handled}",
|
||||
"total number of connections with state {accepted, handled}",
|
||||
[]string{"state"}, constLabels),
|
||||
|
||||
requestsTotal: prometheus.NewDesc(
|
||||
|
|
@ -99,7 +99,7 @@ func NewNGINXStatus(podName, namespace, ingressClass string) (NGINXStatusCollect
|
|||
|
||||
connections: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(PrometheusNamespace, subSystem, "connections"),
|
||||
"current number of client connections with state {reading, writing, waiting}",
|
||||
"current number of client connections with state {active, reading, writing, waiting}",
|
||||
[]string{"state"}, constLabels),
|
||||
}
|
||||
|
||||
|
|
@ -180,14 +180,14 @@ func (p nginxStatusCollector) scrape(ch chan<- prometheus.Metric) {
|
|||
|
||||
s := parse(string(data))
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(p.data.connectionsTotal,
|
||||
prometheus.CounterValue, float64(s.Active), "active")
|
||||
ch <- prometheus.MustNewConstMetric(p.data.connectionsTotal,
|
||||
prometheus.CounterValue, float64(s.Accepted), "accepted")
|
||||
ch <- prometheus.MustNewConstMetric(p.data.connectionsTotal,
|
||||
prometheus.CounterValue, float64(s.Handled), "handled")
|
||||
ch <- prometheus.MustNewConstMetric(p.data.requestsTotal,
|
||||
prometheus.CounterValue, float64(s.Requests))
|
||||
ch <- prometheus.MustNewConstMetric(p.data.connections,
|
||||
prometheus.GaugeValue, float64(s.Active), "active")
|
||||
ch <- prometheus.MustNewConstMetric(p.data.connections,
|
||||
prometheus.GaugeValue, float64(s.Reading), "reading")
|
||||
ch <- prometheus.MustNewConstMetric(p.data.connections,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue