'Extracts metrics from a prometheus histogram and sends them as gauges'

def _submit_gauges_from_histogram(self, name, metric, send_histograms_buckets=True, custom_tags=None):

    if (custom_tags is None):
        custom_tags = []
    val = getattr(metric, self.METRIC_TYPES[4]).sample_count
    self._submit_gauge('{}.count'.format(name), val, metric, custom_tags)
    val = getattr(metric, self.METRIC_TYPES[4]).sample_sum
    self._submit_gauge('{}.sum'.format(name), val, metric, custom_tags)
    if send_histograms_buckets:
        for bucket in getattr(metric, self.METRIC_TYPES[4]).bucket:
            val = bucket.cumulative_count
            limit = bucket.upper_bound
            self._submit_gauge('{}.count'.format(name), val, metric, custom_tags=(custom_tags + ['upper_bound:{}'.format(limit)]))
