(self)
Collect Per Resource Metrics.
Collect Per Resource Metrics.
Collect Per Resource Metrics .
def collect_per_resource_metrics(self):
        # type: () -> None
        """
        Collect Per Resource Metrics.
        """
        for res_type in self.resources_to_monitor.keys():
            for res in self.resources_to_monitor[res_type]:
                tags = ['{}:{}'.format(RESOURCE_TYPES[res_type]['tag_name'], res['name'])] + self._config.tags
                if res.get('group'):
                    tags.append('{}:{}'.format(RESOURCE_TYPES['group']['tag_name'], res['group']))

                try:
                    if RESOURCE_METRICS_AVAILABLE[res_type]['status']:
                        self._collect_resource_status_metrics(res_type, res['uri'], tags)
                except Exception as e:
                    self.log.warning('Status information unavailable for resource %s: %s', res, str(e))

                try:
                    if RESOURCE_METRICS_AVAILABLE[res_type]['storage']:
                        self._collect_resource_storage_metrics(res_type, res['name'], res.get('group'), tags)
                except Exception as e:
                    self.log.warning('Storage information unavailable for resource %s: %s', res, str(e))

                try:
                    if RESOURCE_METRICS_AVAILABLE[res_type]['requests']:
                        self._collect_resource_request_metrics(res_type, res['name'], res.get('group'), tags)
                except Exception as e:
                    self.log.warning('Requests information unavailable for resource %s: %s', res, str(e))
def collect_per_resource_metrics ( self ) : # type: () -> None for res_type in self . resources_to_monitor . keys ( ) : for res in self . resources_to_monitor [ res_type ] : tags = [ '{}:{}' . format ( RESOURCE_TYPES [ res_type ] [ 'tag_name' ] , res [ 'name' ] ) ] + self . _config . tags if res . get ( 'group' ) : tags . append ( '{}:{}' . format ( RESOURCE_TYPES [ 'group' ] [ 'tag_name' ] , res [ 'group' ] ) ) try : if RESOURCE_METRICS_AVAILABLE [ res_type ] [ 'status' ] : self . _collect_resource_status_metrics ( res_type , res [ 'uri' ] , tags ) except Exception as e : self . log . warning ( 'Status information unavailable for resource %s: %s' , res , str ( e ) ) try : if RESOURCE_METRICS_AVAILABLE [ res_type ] [ 'storage' ] : self . _collect_resource_storage_metrics ( res_type , res [ 'name' ] , res . get ( 'group' ) , tags ) except Exception as e : self . log . warning ( 'Storage information unavailable for resource %s: %s' , res , str ( e ) ) try : if RESOURCE_METRICS_AVAILABLE [ res_type ] [ 'requests' ] : self . _collect_resource_request_metrics ( res_type , res [ 'name' ] , res . get ( 'group' ) , tags ) except Exception as e : self . log . warning ( 'Requests information unavailable for resource %s: %s' , res , str ( e ) )