File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -58,20 +58,19 @@ func (pm *PrometheusMetric) SetMetrics() {
5858
5959// Set sets all metrics based on Processes
6060func (pm * PrometheusMetric ) Set () {
61- if len (pm .Server .Processes ) == 0 {
61+ ps := pm .Server .Processes
62+ if len (ps ) == 0 {
6263 return
6364 }
64-
6565 log .Debugf ("Found '%d' processes. Setting metrics...\n " , len (pm .Server .Processes ))
66-
67- pm .connCount .Set (float64 (len (pm .Server .Processes )))
66+ pm .connCount .Set (float64 (len (ps )))
6867
6968 var metricM = map [string ]map [string ]int {}
7069 // todo: keys should be constant at somewhere else and we should iterate through them
7170 metricM ["db" ] = map [string ]int {}
7271 metricM ["host" ] = map [string ]int {}
7372
74- for _ , p := range pm . Server . Processes {
73+ for _ , p := range ps {
7574 // todo: keys should be constant at somewhere else and we should iterate through them
7675 metricM ["db" ][p .DB ]++
7776 metricM ["host" ][p .Host ]++
You can’t perform that action at this time.
0 commit comments