ferruzzi commented on code in PR #41975:
URL: https://github.com/apache/airflow/pull/41975#discussion_r1744224602


##########
airflow/metrics/validators.py:
##########
@@ -118,7 +107,7 @@ def get_validator() -> ListValidator:
     else:
         list_type = DEFAULT_VALIDATOR_TYPE
 
-    return validators[validator_type][list_type](metric_lists[list_type])
+    return validators[list_type](metric_lists[list_type])

Review Comment:
   Non-blocking:   Seeing this now, after the changes you made, I wonder if 
there is a better way to handle these two dicts.  
   
   If you want to call this out of scope for this PR, I won't push it, but 
maybe consider changing this up.
   
   With those two  getting simplified so much, there are far fewer permutations 
here and this entire method could be simplified down to something closer to 
((untested code))
   
   ```
   def get_validator():
       metric_allow_list = conf.get("metrics", "metrics_allow_list", 
fallback=None)
       metric_block_list = conf.get("metrics", "metrics_block_list", 
fallback=None)
   
       if metric_allow_list and metric_block_list:
           log.warning("Ignoring metrics_block_list as both metrics_allow_list 
and metrics_block_list have been set.")
       
       if metric_allow_list or DEFAULT_VALIDATOR_TYPE == "allow":
           return PatternAllowListValidator(metric_allow_list)
       if metric_block_list or DEFAULT_VALIDATOR_TYPE == "block":
           return PatternBlockListValidator(metric_block_list)
   ```



-- 
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: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to