From a549cd4c5204a6dda42dad6b42b619830b15474f Mon Sep 17 00:00:00 2001 From: Grace Wehner Date: Tue, 26 Mar 2024 17:41:12 -0700 Subject: [PATCH] Fix: Change logging from error to info for missing configmap settings to not have errors for older configmaps (#804) --- ...arser-default-targets-metrics-keep-list.rb | 28 +++++++++---------- ...omlparser-pod-annotation-based-scraping.rb | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/otelcollector/configmapparser/tomlparser-default-targets-metrics-keep-list.rb b/otelcollector/configmapparser/tomlparser-default-targets-metrics-keep-list.rb index 937f91ec3..728957324 100644 --- a/otelcollector/configmapparser/tomlparser-default-targets-metrics-keep-list.rb +++ b/otelcollector/configmapparser/tomlparser-default-targets-metrics-keep-list.rb @@ -99,7 +99,7 @@ def populateSettingValuesFromConfigMap(parsedConfig) end end else - ConfigParseErrorLogger.logError(LOGGING_PREFIX, "kubeletRegex either not specified or not of type string") + ConfigParseErrorLogger.log(LOGGING_PREFIX, "kubeletRegex either not specified or not of type string") end corednsRegex = parsedConfig[:coredns] @@ -113,7 +113,7 @@ def populateSettingValuesFromConfigMap(parsedConfig) end end else - ConfigParseErrorLogger.logError(LOGGING_PREFIX, "corednsRegex either not specified or not of type string") + ConfigParseErrorLogger.log(LOGGING_PREFIX, "corednsRegex either not specified or not of type string") end cadvisorRegex = parsedConfig[:cadvisor] @@ -127,7 +127,7 @@ def populateSettingValuesFromConfigMap(parsedConfig) end end else - ConfigParseErrorLogger.logError(LOGGING_PREFIX, "cadvisorRegex either not specified or not of type string") + ConfigParseErrorLogger.log(LOGGING_PREFIX, "cadvisorRegex either not specified or not of type string") end kubeproxyRegex = parsedConfig[:kubeproxy] @@ -141,7 +141,7 @@ def populateSettingValuesFromConfigMap(parsedConfig) end end else - ConfigParseErrorLogger.logError(LOGGING_PREFIX, "kubeproxyRegex either not specified or not of type string") + ConfigParseErrorLogger.log(LOGGING_PREFIX, "kubeproxyRegex either not specified or not of type string") end apiserverRegex = parsedConfig[:apiserver] @@ -155,7 +155,7 @@ def populateSettingValuesFromConfigMap(parsedConfig) end end else - ConfigParseErrorLogger.logError(LOGGING_PREFIX, "apiserverRegex either not specified or not of type string") + ConfigParseErrorLogger.log(LOGGING_PREFIX, "apiserverRegex either not specified or not of type string") end kubestateRegex = parsedConfig[:kubestate] @@ -169,7 +169,7 @@ def populateSettingValuesFromConfigMap(parsedConfig) end end else - ConfigParseErrorLogger.logError(LOGGING_PREFIX, "kubestateRegex either not specified or not of type string") + ConfigParseErrorLogger.log(LOGGING_PREFIX, "kubestateRegex either not specified or not of type string") end nodeexporterRegex = parsedConfig[:nodeexporter] @@ -183,7 +183,7 @@ def populateSettingValuesFromConfigMap(parsedConfig) end end else - ConfigParseErrorLogger.logError(LOGGING_PREFIX, "nodeexporterRegex either not specified or not of type string") + ConfigParseErrorLogger.log(LOGGING_PREFIX, "nodeexporterRegex either not specified or not of type string") end kappiebasicRegex = parsedConfig[:kappiebasic] @@ -197,7 +197,7 @@ def populateSettingValuesFromConfigMap(parsedConfig) end end else - ConfigParseErrorLogger.logError(LOGGING_PREFIX, "kappiebasicRegex either not specified or not of type string") + ConfigParseErrorLogger.log(LOGGING_PREFIX, "kappiebasicRegex either not specified or not of type string") end networkobservabilityRetinaRegex = parsedConfig[:networkobservabilityRetina] @@ -211,7 +211,7 @@ def populateSettingValuesFromConfigMap(parsedConfig) end end else - ConfigParseErrorLogger.logError(LOGGING_PREFIX, "networkobservabilityRetinaRegex either not specified or not of type string") + ConfigParseErrorLogger.log(LOGGING_PREFIX, "networkobservabilityRetinaRegex either not specified or not of type string") end networkobservabilityHubbleRegex = parsedConfig[:networkobservabilityHubble] @@ -225,7 +225,7 @@ def populateSettingValuesFromConfigMap(parsedConfig) end end else - ConfigParseErrorLogger.logError(LOGGING_PREFIX, "networkobservabilityHubbleRegex either not specified or not of type string") + ConfigParseErrorLogger.log(LOGGING_PREFIX, "networkobservabilityHubbleRegex either not specified or not of type string") end networkobservabilityCiliumRegex = parsedConfig[:networkobservabilityCilium] @@ -239,7 +239,7 @@ def populateSettingValuesFromConfigMap(parsedConfig) end end else - ConfigParseErrorLogger.logError(LOGGING_PREFIX, "networkobservabilityCiliumRegex either not specified or not of type string") + ConfigParseErrorLogger.log(LOGGING_PREFIX, "networkobservabilityCiliumRegex either not specified or not of type string") end @@ -255,7 +255,7 @@ def populateSettingValuesFromConfigMap(parsedConfig) end end else - ConfigParseErrorLogger.logError(LOGGING_PREFIX, "windowsexporterRegex either not specified or not of type string") + ConfigParseErrorLogger.log(LOGGING_PREFIX, "windowsexporterRegex either not specified or not of type string") end windowskubeproxyRegex = parsedConfig[:windowskubeproxy] @@ -269,7 +269,7 @@ def populateSettingValuesFromConfigMap(parsedConfig) end end else - ConfigParseErrorLogger.logError(LOGGING_PREFIX, "windowskubeproxyRegex either not specified or not of type string") + ConfigParseErrorLogger.log(LOGGING_PREFIX, "windowskubeproxyRegex either not specified or not of type string") end podannotationRegex = parsedConfig[:podannotations] @@ -283,7 +283,7 @@ def populateSettingValuesFromConfigMap(parsedConfig) end end else - ConfigParseErrorLogger.logError(LOGGING_PREFIX, "podannotationRegex either not specified or not of type string") + ConfigParseErrorLogger.log(LOGGING_PREFIX, "podannotationRegex either not specified or not of type string") end rescue => errorStr ConfigParseErrorLogger.logError(LOGGING_PREFIX, "Exception while reading config map settings for default targets metrics keep list - #{errorStr}, using defaults, please check config map for errors") diff --git a/otelcollector/configmapparser/tomlparser-pod-annotation-based-scraping.rb b/otelcollector/configmapparser/tomlparser-pod-annotation-based-scraping.rb index 362fe4731..b0f00851d 100644 --- a/otelcollector/configmapparser/tomlparser-pod-annotation-based-scraping.rb +++ b/otelcollector/configmapparser/tomlparser-pod-annotation-based-scraping.rb @@ -43,7 +43,7 @@ def populateSettingValuesFromConfigMap(parsedConfig) ConfigParseErrorLogger.logError(LOGGING_PREFIX, "Invalid namespace regex for podannotations") end else - ConfigParseErrorLogger.logError(LOGGING_PREFIX, "podannotations namespace regex either not specified or not of type string") + ConfigParseErrorLogger.log(LOGGING_PREFIX, "podannotations namespace regex either not specified or not of type string") end end end