def _histogram_convert_values(self, metric_name, converter):

    def _convert(metric, scraper_config=None):
        for (index, sample) in enumerate(metric.samples):
            val = sample[self.SAMPLE_VALUE]
            if (not self._is_value_valid(val)):
                self.log.debug('Metric value is not supported for metric %s', sample[self.SAMPLE_NAME])
                continue
            if sample[self.SAMPLE_NAME].endswith('_sum'):
                lst = list(sample)
                lst[self.SAMPLE_VALUE] = converter(val)
                metric.samples[index] = tuple(lst)
            elif (sample[self.SAMPLE_NAME].endswith('_bucket') and ('Inf' not in sample[self.SAMPLE_LABELS]['le'])):
                sample[self.SAMPLE_LABELS]['le'] = str(converter(float(sample[self.SAMPLE_LABELS]['le'])))
        self.submit_openmetric(metric_name, metric, scraper_config)
    return _convert
def _histogram_convert_values(self, metric_name, converter):

    def _convert(metric, scraper_config=None):
        for (index, sample) in enumerate(metric.samples):
            val = sample[self.SAMPLE_VALUE]
            if (not self._is_value_valid(val)):
                self.log.debug('Metric value is not supported for metric %s', sample[self.SAMPLE_NAME])
                continue
            if sample[self.SAMPLE_NAME].endswith('_sum'):
                lst = list(sample)
                lst[self.SAMPLE_VALUE] = converter(val)
                metric.samples[index] = tuple(lst)
            elif (sample[self.SAMPLE_NAME].endswith('_bucket') and ('Inf' not in sample[self.SAMPLE_LABELS]['le'])):
                sample[self.SAMPLE_LABELS]['le'] = str(converter(float(sample[self.SAMPLE_LABELS]['le'])))
        self.submit_openmetric(metric_name, metric, scraper_config)
    return _convert