(self, metric, dat, tags, is_pod, depth=0)
Recursively parses and submit metrics for a given entity, until
        reaching self.max_depth.
        Nested metric names are flattened: memory/usage -> memory.usage
        :param: metric: parent's metric name (check namespace for root stat objects)
        :param: dat: metric dictionary to parse
        :param: tags: entity tags to use when submitting
        :param: is_pod: is the entity a pod (bool)
        :param: depth: current depth of recursion
Recursively parses and submit metrics for a given entity, until
        reaching self.max_depth.
        Nested metric names are flattened: memory/usage -> memory.usage
        :param: metric: parent's metric name (check namespace for root stat objects)
        :param: dat: metric dictionary to parse
        :param: tags: entity tags to use when submitting
        :param: is_pod: is the entity a pod (bool)
        :param: depth: current depth of recursion
Recursively parses and submit metrics for a given entity until reaching self . max_depth . Nested metric names are flattened : memory / usage - > memory . usage : param : metric : parent s metric name ( check namespace for root stat objects ) : param : dat : metric dictionary to parse : param : tags : entity tags to use when submitting : param : is_pod : is the entity a pod ( bool ) : param : depth : current depth of recursion
def _publish_raw_metrics(self, metric, dat, tags, is_pod, depth=0):
        """
        Recursively parses and submit metrics for a given entity, until
        reaching self.max_depth.
        Nested metric names are flattened: memory/usage -> memory.usage
        :param: metric: parent's metric name (check namespace for root stat objects)
        :param: dat: metric dictionary to parse
        :param: tags: entity tags to use when submitting
        :param: is_pod: is the entity a pod (bool)
        :param: depth: current depth of recursion
        """
        if depth >= self.max_depth:
            self.log.warning('Reached max depth on metric=%s', metric)
            return

        if isinstance(dat, numbers.Number):
            # Pod level metric filtering
            is_pod_metric = False
            if self.pod_level_metrics and any([fnmatch(metric, pat) for pat in self.pod_level_metrics]):
                is_pod_metric = True
            if is_pod_metric != is_pod:
                return

            # Metric submission
            if self.enabled_rates and any([fnmatch(metric, pat) for pat in self.enabled_rates]):
                self.rate(metric, float(dat), tags)
            elif self.enabled_gauges and any([fnmatch(metric, pat) for pat in self.enabled_gauges]):
                self.gauge(metric, float(dat), tags)

        elif isinstance(dat, dict):
            for k, v in iteritems(dat):
                self._publish_raw_metrics(metric + '.%s' % k.lower(), v, tags, is_pod, depth + 1)

        elif isinstance(dat, list):
            self._publish_raw_metrics(metric, dat[-1], tags, is_pod, depth + 1)
def _publish_raw_metrics ( self , metric , dat , tags , is_pod , depth = 0 ) : if depth >= self . max_depth : self . log . warning ( 'Reached max depth on metric=%s' , metric ) return if isinstance ( dat , numbers . Number ) : # Pod level metric filtering is_pod_metric = False if self . pod_level_metrics and any ( [ fnmatch ( metric , pat ) for pat in self . pod_level_metrics ] ) : is_pod_metric = True if is_pod_metric != is_pod : return # Metric submission if self . enabled_rates and any ( [ fnmatch ( metric , pat ) for pat in self . enabled_rates ] ) : self . rate ( metric , float ( dat ) , tags ) elif self . enabled_gauges and any ( [ fnmatch ( metric , pat ) for pat in self . enabled_gauges ] ) : self . gauge ( metric , float ( dat ) , tags ) elif isinstance ( dat , dict ) : for k , v in iteritems ( dat ) : self . _publish_raw_metrics ( metric + '.%s' % k . lower ( ) , v , tags , is_pod , depth + 1 ) elif isinstance ( dat , list ) : self . _publish_raw_metrics ( metric , dat [ - 1 ] , tags , is_pod , depth + 1 )