villebro commented on code in PR #25118:
URL: https://github.com/apache/superset/pull/25118#discussion_r1309472054
##########
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:
You're right, maybe we should just add it to StatsdStatsLogger, and remove
it from BaseStatsLogger. This will cover the vanilla StatsD use case, and
should serve as an example for anyone who wants similar functionality in their
own custom logger class. Thoughts @eschutho
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]