def _mapreduce_job_counters_metrics(self, running_jobs, addl_tags):
    '\n        Get custom metrics specified for each counter\n        '
    for (job_id, job_metrics) in running_jobs.iteritems():
        job_name = job_metrics['job_name']
        if (self.general_counters or (job_name in self.job_specific_counters)):
            job_specific_metrics = self.job_specific_counters.get(job_name)
            metrics_json = self._rest_request_to_json(job_metrics['tracking_url'], 'counters', MAPREDUCE_SERVICE_CHECK)
            if metrics_json.get('jobCounters'):
                if metrics_json['jobCounters'].get('counterGroup'):
                    for counter_group in metrics_json['jobCounters']['counterGroup']:
                        group_name = counter_group.get('counterGroupName')
                        if group_name:
                            counter_metrics = set([])
                            if (job_specific_metrics and (group_name in job_specific_metrics)):
                                counter_metrics = counter_metrics.union(job_specific_metrics[group_name])
                            if (group_name in self.general_counters):
                                counter_metrics = counter_metrics.union(self.general_counters[group_name])
                            if counter_metrics:
                                if counter_group.get('counter'):
                                    for counter in counter_group['counter']:
                                        counter_name = counter.get('name')
                                        if (counter_name and (counter_name in counter_metrics)):
                                            tags = [('app_name:' + job_metrics.get('app_name')), ('user_name:' + job_metrics.get('user_name')), ('job_name:' + job_name), ('counter_name:' + str(counter_name).lower())]
                                            tags.extend(addl_tags)
                                            self._set_metrics_from_json(tags, counter, MAPREDUCE_JOB_COUNTER_METRICS)
Get custom metrics specified for each counter
def _mapreduce_job_counters_metrics(self, running_jobs, addl_tags):
    '\n        \n        '
    for (job_id, job_metrics) in running_jobs.iteritems():
        job_name = job_metrics['job_name']
        if (self.general_counters or (job_name in self.job_specific_counters)):
            job_specific_metrics = self.job_specific_counters.get(job_name)
            metrics_json = self._rest_request_to_json(job_metrics['tracking_url'], 'counters', MAPREDUCE_SERVICE_CHECK)
            if metrics_json.get('jobCounters'):
                if metrics_json['jobCounters'].get('counterGroup'):
                    for counter_group in metrics_json['jobCounters']['counterGroup']:
                        group_name = counter_group.get('counterGroupName')
                        if group_name:
                            counter_metrics = set([])
                            if (job_specific_metrics and (group_name in job_specific_metrics)):
                                counter_metrics = counter_metrics.union(job_specific_metrics[group_name])
                            if (group_name in self.general_counters):
                                counter_metrics = counter_metrics.union(self.general_counters[group_name])
                            if counter_metrics:
                                if counter_group.get('counter'):
                                    for counter in counter_group['counter']:
                                        counter_name = counter.get('name')
                                        if (counter_name and (counter_name in counter_metrics)):
                                            tags = [('app_name:' + job_metrics.get('app_name')), ('user_name:' + job_metrics.get('user_name')), ('job_name:' + job_name), ('counter_name:' + str(counter_name).lower())]
                                            tags.extend(addl_tags)
                                            self._set_metrics_from_json(tags, counter, MAPREDUCE_JOB_COUNTER_METRICS)