From 7e6f6c32c568d75dde4ac6b11d28ff916606b786 Mon Sep 17 00:00:00 2001 From: Enrico Stahn Date: Wed, 28 Feb 2018 15:53:04 +1100 Subject: [PATCH] Rename label for phpfpm_processes_* from `pid` to `pid_hash` --- phpfpm/exporter.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/phpfpm/exporter.go b/phpfpm/exporter.go index a817791..effe289 100644 --- a/phpfpm/exporter.go +++ b/phpfpm/exporter.go @@ -139,25 +139,25 @@ func NewExporter(pm PoolManager) *Exporter { processRequests: prometheus.NewDesc( prometheus.BuildFQName(namespace, "", "process_requests"), "", - []string{"pool", "pid"}, + []string{"pool", "pid_hash"}, nil), processLastRequestMemory: prometheus.NewDesc( prometheus.BuildFQName(namespace, "", "process_last_request_memory"), "", - []string{"pool", "pid"}, + []string{"pool", "pid_hash"}, nil), processLastRequestCPU: prometheus.NewDesc( prometheus.BuildFQName(namespace, "", "process_last_request_cpu"), "", - []string{"pool", "pid"}, + []string{"pool", "pid_hash"}, nil), processState: prometheus.NewDesc( prometheus.BuildFQName(namespace, "", "process_state"), "The process state.", - []string{"pool", "pid", "state"}, + []string{"pool", "pid_hash", "state"}, nil), } } @@ -203,11 +203,11 @@ func (e *Exporter) Collect(ch chan<- prometheus.Metric) { ch <- prometheus.MustNewConstMetric(e.slowRequests, prometheus.CounterValue, float64(pool.SlowRequests), pool.Name) for _, process := range pool.Processes { - pid := calculateProcessHash(process) - ch <- prometheus.MustNewConstMetric(e.processState, prometheus.GaugeValue, 1, pool.Name, pid, process.State) - ch <- prometheus.MustNewConstMetric(e.processRequests, prometheus.CounterValue, float64(process.Requests), pool.Name, pid) - ch <- prometheus.MustNewConstMetric(e.processLastRequestMemory, prometheus.GaugeValue, float64(process.LastRequestMemory), pool.Name, pid) - ch <- prometheus.MustNewConstMetric(e.processLastRequestCPU, prometheus.GaugeValue, process.LastRequestCPU, pool.Name, pid) + pidHash := calculateProcessHash(process) + ch <- prometheus.MustNewConstMetric(e.processState, prometheus.GaugeValue, 1, pool.Name, pidHash, process.State) + ch <- prometheus.MustNewConstMetric(e.processRequests, prometheus.CounterValue, float64(process.Requests), pool.Name, pidHash) + ch <- prometheus.MustNewConstMetric(e.processLastRequestMemory, prometheus.GaugeValue, float64(process.LastRequestMemory), pool.Name, pidHash) + ch <- prometheus.MustNewConstMetric(e.processLastRequestCPU, prometheus.GaugeValue, process.LastRequestCPU, pool.Name, pidHash) } } }