@@ -175,25 +175,37 @@ func (m *ProcStatusMetric) PushCollected(ch chan<- prometheus.Metric, descs map[
175175 }
176176 m .Unlock ()
177177
178- ch <- prometheus .MustNewConstMetric (descs ["grouped_process_status_VmPeak_bytes_total" ], prometheus .GaugeValue , vmPeak , grouper , group )
179- ch <- prometheus .MustNewConstMetric (descs ["grouped_process_status_VmSize_bytes_total" ], prometheus .GaugeValue , vmSize , grouper , group )
180- ch <- prometheus .MustNewConstMetric (descs ["grouped_process_status_VmLck_bytes_total" ], prometheus .GaugeValue , vmLck , grouper , group )
181- ch <- prometheus .MustNewConstMetric (descs ["grouped_process_status_VmPin_bytes_total" ], prometheus .GaugeValue , vmPin , grouper , group )
182- ch <- prometheus .MustNewConstMetric (descs ["grouped_process_status_VmHWM_bytes_total" ], prometheus .GaugeValue , vmHWM , grouper , group )
183- ch <- prometheus .MustNewConstMetric (descs ["grouped_process_status_VmRSS_bytes_total" ], prometheus .GaugeValue , vmRSS , grouper , group )
184- ch <- prometheus .MustNewConstMetric (descs ["grouped_process_status_RssAnon_bytes_total" ], prometheus .GaugeValue , rssAnon , grouper , group )
185- ch <- prometheus .MustNewConstMetric (descs ["grouped_process_status_RssFile_bytes_total" ], prometheus .GaugeValue , rssFile , grouper , group )
186- ch <- prometheus .MustNewConstMetric (descs ["grouped_process_status_RssShmem_bytes_total" ], prometheus .GaugeValue , rssShmem , grouper , group )
187- ch <- prometheus .MustNewConstMetric (descs ["grouped_process_status_VmData_bytes_total" ], prometheus .GaugeValue , vmData , grouper , group )
188- ch <- prometheus .MustNewConstMetric (descs ["grouped_process_status_VmStk_bytes_total" ], prometheus .GaugeValue , vmStk , grouper , group )
189- ch <- prometheus .MustNewConstMetric (descs ["grouped_process_status_VmExe_bytes_total" ], prometheus .GaugeValue , vmExe , grouper , group )
190- ch <- prometheus .MustNewConstMetric (descs ["grouped_process_status_VmLib_bytes_total" ], prometheus .GaugeValue , vmLib , grouper , group )
191- ch <- prometheus .MustNewConstMetric (descs ["grouped_process_status_VmPTE_bytes_total" ], prometheus .GaugeValue , vmPTE , grouper , group )
192- ch <- prometheus .MustNewConstMetric (descs ["grouped_process_status_VmPMD_bytes_total" ], prometheus .GaugeValue , vmPMD , grouper , group )
193- ch <- prometheus .MustNewConstMetric (descs ["grouped_process_status_VmSwap_bytes_total" ], prometheus .GaugeValue , vmSwap , grouper , group )
194- ch <- prometheus .MustNewConstMetric (descs ["grouped_process_status_HugetlbPages_bytes_total" ], prometheus .GaugeValue , hugetlbPages , grouper , group )
195- ch <- prometheus .MustNewConstMetric (descs ["grouped_process_status_VoluntaryCtxtSwitches_total" ], prometheus .CounterValue , voluntaryCtxtSwitches , grouper , group )
196- ch <- prometheus .MustNewConstMetric (descs ["grouped_process_status_NonVoluntaryCtxtSwitches_total" ], prometheus .CounterValue , nonVoluntaryCtxtSwitches , grouper , group )
178+ values := []struct {
179+ k string
180+ t prometheus.ValueType
181+ v float64
182+ }{
183+ {"grouped_process_status_VmPeak_bytes_total" , prometheus .GaugeValue , vmPeak },
184+ {"grouped_process_status_VmSize_bytes_total" , prometheus .GaugeValue , vmSize },
185+ {"grouped_process_status_VmLck_bytes_total" , prometheus .GaugeValue , vmLck },
186+ {"grouped_process_status_VmPin_bytes_total" , prometheus .GaugeValue , vmPin },
187+ {"grouped_process_status_VmHWM_bytes_total" , prometheus .GaugeValue , vmHWM },
188+ {"grouped_process_status_VmRSS_bytes_total" , prometheus .GaugeValue , vmRSS },
189+ {"grouped_process_status_RssAnon_bytes_total" , prometheus .GaugeValue , rssAnon },
190+ {"grouped_process_status_RssFile_bytes_total" , prometheus .GaugeValue , rssFile },
191+ {"grouped_process_status_RssShmem_bytes_total" , prometheus .GaugeValue , rssShmem },
192+ {"grouped_process_status_VmData_bytes_total" , prometheus .GaugeValue , vmData },
193+ {"grouped_process_status_VmStk_bytes_total" , prometheus .GaugeValue , vmStk },
194+ {"grouped_process_status_VmExe_bytes_total" , prometheus .GaugeValue , vmExe },
195+ {"grouped_process_status_VmLib_bytes_total" , prometheus .GaugeValue , vmLib },
196+ {"grouped_process_status_VmPTE_bytes_total" , prometheus .GaugeValue , vmPTE },
197+ {"grouped_process_status_VmPMD_bytes_total" , prometheus .GaugeValue , vmPMD },
198+ {"grouped_process_status_VmSwap_bytes_total" , prometheus .GaugeValue , vmSwap },
199+ {"grouped_process_status_HugetlbPages_bytes_total" , prometheus .GaugeValue , hugetlbPages },
200+ {"grouped_process_status_VoluntaryCtxtSwitches_total" , prometheus .CounterValue , voluntaryCtxtSwitches },
201+ {"grouped_process_status_NonVoluntaryCtxtSwitches_total" , prometheus .CounterValue , nonVoluntaryCtxtSwitches },
202+ }
203+
204+ for _ , s := range values {
205+ if d , ok := descs [s .k ]; ok {
206+ ch <- prometheus .MustNewConstMetric (d , s .t , s .v , grouper , group )
207+ }
208+ }
197209
198210 return nil
199211}
0 commit comments