(self, running_apps, addl_tags)
Get metrics for each Spark stage.
Get metrics for each Spark stage.
Get metrics for each Spark stage .
def _spark_stage_metrics(self, running_apps, addl_tags):
        """
        Get metrics for each Spark stage.
        """
        for app_id, (app_name, tracking_url) in iteritems(running_apps):

            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, 'stages'
            )

            for stage in response:

                status = stage.get('status')

                tags = ['app_name:%s' % str(app_name)]
                tags.extend(addl_tags)
                tags.append('status:%s' % str(status).lower())

                stage_id = stage.get('stageId')
                if stage_id is not None:
                    tags.append('stage_id:{}'.format(stage_id))

                self._set_metrics_from_json(tags, stage, SPARK_STAGE_METRICS)
                self._set_metric('spark.stage.count', COUNT, 1, tags)
def _spark_stage_metrics ( self , running_apps , addl_tags ) : for app_id , ( app_name , tracking_url ) in iteritems ( running_apps ) : 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 , 'stages' ) for stage in response : status = stage . get ( 'status' ) tags = [ 'app_name:%s' % str ( app_name ) ] tags . extend ( addl_tags ) tags . append ( 'status:%s' % str ( status ) . lower ( ) ) stage_id = stage . get ( 'stageId' ) if stage_id is not None : tags . append ( 'stage_id:{}' . format ( stage_id ) ) self . _set_metrics_from_json ( tags , stage , SPARK_STAGE_METRICS ) self . _set_metric ( 'spark.stage.count' , COUNT , 1 , tags )