From 6314b9fdf03cc741328e97a17ac3ba40d9f5d50c Mon Sep 17 00:00:00 2001 From: Yao Hong Kok Date: Mon, 29 Aug 2022 05:54:23 -0400 Subject: [PATCH] Remove underscore from variable name --- exporter/collector.go | 6 +++--- exporter/util.go | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/exporter/collector.go b/exporter/collector.go index 4202f3df..8b70e9c5 100644 --- a/exporter/collector.go +++ b/exporter/collector.go @@ -166,11 +166,11 @@ func extractLabels(logger log.Logger, data []byte, paths []string) []string { // Returns the conversion of the dynamic value- if it exists in the ValueConverter configuration func convertValueIfNeeded(m JSONMetric, value string) string { if m.ValueConverter != nil { - if value_mappings, hasPathKey := m.ValueConverter[m.ValueJSONPath]; hasPathKey { + if valueMappings, hasPathKey := m.ValueConverter[m.ValueJSONPath]; hasPathKey { value = strings.ToLower(value) - if _, hasValueKey := value_mappings[value]; hasValueKey { - value = value_mappings[value] + if _, hasValueKey := valueMappings[value]; hasValueKey { + value = valueMappings[value] } } } diff --git a/exporter/util.go b/exporter/util.go index 7eb268ab..1c469228 100644 --- a/exporter/util.go +++ b/exporter/util.go @@ -242,11 +242,11 @@ func initializeValueConverter(metric config.Metric) config.ValueConverterType { //convert all keys to lowercase if metric.ValueConverter != nil { valueConverters = make(config.ValueConverterType) - for values_key, inner_map := range metric.ValueConverter { + for valuesKey, innerMap := range metric.ValueConverter { //make the mappings for each value key lowercase - valueConverters[values_key] = make(map[string]string) - for conversion_from, conversion_to := range inner_map { - valueConverters[values_key][strings.ToLower(conversion_from)] = conversion_to + valueConverters[valuesKey] = make(map[string]string) + for conversionFrom, conversionTo := range innerMap { + valueConverters[valuesKey][strings.ToLower(conversionFrom)] = conversionTo } } }