rkhachatryan commented on code in PR #28917:
URL: https://github.com/apache/flink/pull/28917#discussion_r3730071992


##########
flink-core/src/main/java/org/apache/flink/util/MdcUtils.java:
##########
@@ -162,9 +178,18 @@ public static Map<String, String> asContextData(
                 jobConfiguration.get(MdcOptions.JOB_CONFIGURATION_TO_MDC_KEYS);
         final Map<String, String> context = new HashMap<>();
         for (Map.Entry<String, String> entry : mdcKeyMapping.entrySet()) {
+            final String mdcKeyName = entry.getValue();
+            if (mdcKeyName == null || mdcKeyName.isBlank()) {
+                if (WARNED_BLANK_MDC_KEYS.add(entry.getKey())) {
+                    LOG.warn(
+                            "MDC key name for configuration key '{}' is blank; 
skipping.",
+                            entry.getKey());
+                }
+                continue;

Review Comment:
   TBH this solutions seems a bit too complex for the problem to me..
   What if we instead interpret empty `mdcKeyName` as an intention to use 
`entry.getKey()` for both job config parameter and logging key?
   
   That adds some convenience and eliminates the problem with empty keys.
   
   WDYT?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to