(self, data, metric, xtype, path, xform=None, tags=None, hostname=None)
data: dictionary containing all the stats
        metric: datadog metric
        path: corresponding path in data, flattened, e.g. thread_pool.bulk.queue
        xform: a lambda to apply to the numerical value
data: dictionary containing all the stats
        metric: datadog metric
        path: corresponding path in data, flattened, e.g. thread_pool.bulk.queue
        xform: a lambda to apply to the numerical value
data : dictionary containing all the stats metric : datadog metric path : corresponding path in data flattened e . g . thread_pool . bulk . queue xform : a lambda to apply to the numerical value
def _process_metric(self, data, metric, xtype, path, xform=None, tags=None, hostname=None):
        """
        data: dictionary containing all the stats
        metric: datadog metric
        path: corresponding path in data, flattened, e.g. thread_pool.bulk.queue
        xform: a lambda to apply to the numerical value
        """
        value = data

        # Traverse the nested dictionaries
        for key in re.split(r'(?<!\\)\.', path):
            if value is not None:
                value = value.get(key.replace('\\', ''))
            else:
                break

        if value is not None:
            if xform:
                value = xform(value)
            if xtype == "gauge":
                self.gauge(metric, value, tags=tags, hostname=hostname)
            elif xtype == "monotonic_count":
                self.monotonic_count(metric, value, tags=tags, hostname=hostname)
            else:
                self.rate(metric, value, tags=tags, hostname=hostname)
        else:
            self.log.debug("Metric not found: %s -> %s", path, metric)
def _process_metric ( self , data , metric , xtype , path , xform = None , tags = None , hostname = None ) : value = data # Traverse the nested dictionaries for key in re . split ( r'(?<!\\)\.' , path ) : if value is not None : value = value . get ( key . replace ( '\\' , '' ) ) else : break if value is not None : if xform : value = xform ( value ) if xtype == "gauge" : self . gauge ( metric , value , tags = tags , hostname = hostname ) elif xtype == "monotonic_count" : self . monotonic_count ( metric , value , tags = tags , hostname = hostname ) else : self . rate ( metric , value , tags = tags , hostname = hostname ) else : self . log . debug ( "Metric not found: %s -> %s" , path , metric )