Get metrics for running applications

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

        if metrics_json and metrics_json['apps'] is not None and metrics_json['apps']['app'] is not None:

            for app_json in metrics_json['apps']['app']:

                tags = []
                for dd_tag, yarn_key in iteritems(app_tags):
                    try:
                        val = app_json[yarn_key]
                        if val:
                            tags.append('{tag}:{value}'.format(tag=dd_tag, value=val))
                    except KeyError:
                        self.log.error("Invalid value {} for application_tag".format(yarn_key))

                tags.extend(addl_tags)

                self._set_yarn_metrics_from_json(tags, app_json, YARN_APP_METRICS)