From 70f2e46c41369ae75e14d049a9c23f60eb48fe7a Mon Sep 17 00:00:00 2001 From: Ambarish Singh Date: Tue, 26 Sep 2023 16:13:24 +0530 Subject: [PATCH] default value of "UNKNOWN" all custom tags --- pumps/prometheus.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pumps/prometheus.go b/pumps/prometheus.go index b133476d1..7f1dff6be 100644 --- a/pumps/prometheus.go +++ b/pumps/prometheus.go @@ -393,6 +393,19 @@ func (pm *PrometheusMetric) GetLabelsValues(decoded analytics.AnalyticsRecord) [ for _, label := range pm.Labels { if val, ok := mapping[label]; ok { values = append(values, fmt.Sprint(val)) + }else{ + // log.Info(label) + val = "UNKNOWN" + for _, tag := range decoded.Tags{ + prefixString := label + "-" + if strings.HasPrefix(tag,prefixString){ + val = tag[len(prefixString):] + break + } + } + if label != "type" { + values = append(values, fmt.Sprint(val)) + } } } return values