From 45e5e1814aa97bdf91ca568b49b21865a056d1a9 Mon Sep 17 00:00:00 2001 From: Joe Handzik Date: Thu, 15 Jun 2017 13:15:07 -0500 Subject: [PATCH] Don't populate empty labels for rpc_stats Signed-Off-By: Joe Handzik --- sources/procfs.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sources/procfs.go b/sources/procfs.go index f67f1f57..d98008a1 100644 --- a/sources/procfs.go +++ b/sources/procfs.go @@ -308,7 +308,11 @@ func (s *lustreProcfsSource) Update(ch chan<- prometheus.Metric) (err error) { } case "brw_stats", "rpc_stats": err = s.parseBRWStats(metric.source, "stats", path, directoryDepth, metric.helpText, metric.promName, metric.hasMultipleVals, func(nodeType string, brwOperation string, brwSize string, nodeName string, name string, helpText string, value uint64, extraLabel string, extraLabelValue string) { - ch <- metric.metricFunc([]string{nodeType, "operation", "size", extraLabel}, []string{nodeName, brwOperation, brwSize, extraLabelValue}, name, helpText, value) + if extraLabelValue == "" { + ch <- metric.metricFunc([]string{nodeType, "operation", "size"}, []string{nodeName, brwOperation, brwSize}, name, helpText, value) + } else { + ch <- metric.metricFunc([]string{nodeType, "operation", "size", extraLabel}, []string{nodeName, brwOperation, brwSize, extraLabelValue}, name, helpText, value) + } }) if err != nil { return err