bkyryliuk commented on code in PR #25118:
URL: https://github.com/apache/superset/pull/25118#discussion_r1312543342


##########
superset/stats_logger.py:
##########
@@ -51,24 +63,30 @@ def gauge(self, key: str, value: float) -> None:
 
 class DummyStatsLogger(BaseStatsLogger):
     def incr(self, key: str) -> None:
-        logger.debug(Fore.CYAN + "[stats_logger] (incr) " + key + 
Style.RESET_ALL)
+        if self.should_log(key):
+            logger.debug(Fore.CYAN + "[stats_logger] (incr) " + key + 
Style.RESET_ALL)
 
     def decr(self, key: str) -> None:
-        logger.debug(Fore.CYAN + "[stats_logger] (decr) " + key + 
Style.RESET_ALL)
+        if self.should_log(key):
+            logger.debug(Fore.CYAN + "[stats_logger] (decr) " + key + 
Style.RESET_ALL)
 
     def timing(self, key: str, value: float) -> None:
-        logger.debug(
-            Fore.CYAN + f"[stats_logger] (timing) {key} | {value} " + 
Style.RESET_ALL
-        )
+        if self.should_log(key):
+            logger.debug(
+                Fore.CYAN
+                + f"[stats_logger] (timing) {key} | {value} "
+                + Style.RESET_ALL
+            )
 
     def gauge(self, key: str, value: float) -> None:
-        logger.debug(
-            Fore.CYAN
-            + "[stats_logger] (gauge) "
-            + f"{key}"
-            + f"{value}"
-            + Style.RESET_ALL
-        )
+        if self.should_log(key):

Review Comment:
   +1 to comments above.
   I don't find much value in having the deny list and find `def should_log` 
sufficient for filtering and good enough example on how to define a custom 
logger with filtering.
   
   But that's just a minor preference and current solution is fine by me as well



-- 
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: notifications-unsubscr...@superset.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to