Skip to content

Commit

Permalink
Remove underscore from variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
yhk-mw committed Aug 29, 2022
1 parent 9500f3c commit 6314b9f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions exporter/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions exporter/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
Expand Down

0 comments on commit 6314b9f

Please sign in to comment.