(self, name, prev_keys, key, data)
Recursively publish keys
Recursively publish keys
Recursively publish keys
def _publish_metrics(self, name, prev_keys, key, data):
        """Recursively publish keys"""
        value = data[key]
        keys = prev_keys + [key]
        if isinstance(value, dict):
            for new_key in value:
                self._publish_metrics(name, keys, new_key, value)
        elif isinstance(value, (float, int, long)):
            joined_keys = '.'.join(keys)
            if name:
                publish_key = '{}.{}'.format(name, joined_keys)
            else:
                publish_key = joined_keys
            if isinstance(value, bool):
                value = int(value)

            self.publish(publish_key, value)
def _publish_metrics ( self , name , prev_keys , key , data ) : value = data [ key ] keys = prev_keys + [ key ] if isinstance ( value , dict ) : for new_key in value : self . _publish_metrics ( name , keys , new_key , value ) elif isinstance ( value , ( float , int , long ) ) : joined_keys = '.' . join ( keys ) if name : publish_key = '{}.{}' . format ( name , joined_keys ) else : publish_key = joined_keys if isinstance ( value , bool ) : value = int ( value ) self . publish ( publish_key , value )