chandulal commented on a change in pull request #7376: [AIRFLOW-2906] Add 
datadog(dogstatsd) support to send airflow metrics
URL: https://github.com/apache/airflow/pull/7376#discussion_r376189544
 
 

 ##########
 File path: airflow/stats.py
 ##########
 @@ -135,19 +135,91 @@ def timing(self, stat, dt):
             return self.statsd.timing(stat, dt)
 
 
-Stats = DummyStatsLogger  # type: Any
+class SafeDogStatsdLogger:
 
-try:
-    if conf.getboolean('scheduler', 'statsd_on'):
-        from statsd import StatsClient
+    def __init__(self, dogstatsd_client, 
allow_list_validator=AllowListValidator()):
+        self.dogstatsd = dogstatsd_client
+        self.allow_list_validator = allow_list_validator
+
+    @validate_stat
+    def incr(self, stat, count=1, rate=1, tags=None):
+        if self.allow_list_validator.test(stat):
+            if tags is None:
+                tags = []
 
 Review comment:
   I have updated the code with your suggestion.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to