(self, running_apps, addl_tags)
Get metrics for each application streaming statistics.
Get metrics for each application streaming statistics.
Get metrics for each application streaming statistics .
def _spark_streaming_statistics_metrics(self, running_apps, addl_tags):
        """
        Get metrics for each application streaming statistics.
        """
        for app_id, (app_name, tracking_url) in iteritems(running_apps):
            try:
                base_url = self._get_request_url(tracking_url)
                response = self._rest_request_to_json(
                    base_url, SPARK_APPS_PATH, SPARK_SERVICE_CHECK, addl_tags, app_id, 'streaming/statistics'
                )
                self.log.debug('streaming/statistics: %s', response)
                tags = ['app_name:%s' % str(app_name)]
                tags.extend(addl_tags)

                # NOTE: response is a dict
                self._set_metrics_from_json(tags, response, SPARK_STREAMING_STATISTICS_METRICS)
            except HTTPError as e:
                # NOTE: If api call returns response 404
                # then it means that the application is not a streaming application, we should skip metric submission
                if e.response.status_code != 404:
                    raise
def _spark_streaming_statistics_metrics ( self , running_apps , addl_tags ) : for app_id , ( app_name , tracking_url ) in iteritems ( running_apps ) : try : base_url = self . _get_request_url ( tracking_url ) response = self . _rest_request_to_json ( base_url , SPARK_APPS_PATH , SPARK_SERVICE_CHECK , addl_tags , app_id , 'streaming/statistics' ) self . log . debug ( 'streaming/statistics: %s' , response ) tags = [ 'app_name:%s' % str ( app_name ) ] tags . extend ( addl_tags ) # NOTE: response is a dict self . _set_metrics_from_json ( tags , response , SPARK_STREAMING_STATISTICS_METRICS ) except HTTPError as e : # NOTE: If api call returns response 404 # then it means that the application is not a streaming application, we should skip metric submission if e . response . status_code != 404 : raise