(self, rm_address, app_tags, addl_tags)
Get metrics for running applications
Get metrics for running applications
Get metrics for running applications
def _yarn_app_metrics(self, rm_address, app_tags, addl_tags):
        """
        Get metrics for running applications
        """
        metrics_json = self._rest_request_to_json(rm_address, YARN_APPS_PATH, addl_tags)

        if metrics_json and metrics_json.get('apps') and metrics_json['apps'].get('app') is not None:
            for app_json in metrics_json['apps']['app']:
                tags = self._get_app_tags(app_json, app_tags) + addl_tags

                if app_json['state'] == YARN_APPLICATION_RUNNING:
                    self._set_yarn_metrics_from_json(tags, app_json, DEPRECATED_YARN_APP_METRICS)
                    self._set_yarn_metrics_from_json(tags, app_json, YARN_APP_METRICS)

                self.service_check(
                    APPLICATION_STATUS_SERVICE_CHECK,
                    self.application_status_mapping.get(app_json['state'], AgentCheck.UNKNOWN),
                    tags=tags,
                )
def _yarn_app_metrics ( self , rm_address , app_tags , addl_tags ) : metrics_json = self . _rest_request_to_json ( rm_address , YARN_APPS_PATH , addl_tags ) if metrics_json and metrics_json . get ( 'apps' ) and metrics_json [ 'apps' ] . get ( 'app' ) is not None : for app_json in metrics_json [ 'apps' ] [ 'app' ] : tags = self . _get_app_tags ( app_json , app_tags ) + addl_tags if app_json [ 'state' ] == YARN_APPLICATION_RUNNING : self . _set_yarn_metrics_from_json ( tags , app_json , DEPRECATED_YARN_APP_METRICS ) self . _set_yarn_metrics_from_json ( tags , app_json , YARN_APP_METRICS ) self . service_check ( APPLICATION_STATUS_SERVICE_CHECK , self . application_status_mapping . get ( app_json [ 'state' ] , AgentCheck . UNKNOWN ) , tags = tags , )