def _submit_gauges_from_summary(self, metric_name, metric, scraper_config, hostname=None):
    '\n        Extracts metrics from a prometheus summary metric and sends them as gauges\n        '
    for sample in 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 self._ignore_metrics_by_label(scraper_config, metric_name, sample):
            continue
        custom_hostname = self._get_hostname(hostname, sample, scraper_config)
        if sample[self.SAMPLE_NAME].endswith('_sum'):
            tags = self._metric_tags(metric_name, val, sample, scraper_config, hostname=custom_hostname)
            self._submit_distribution_count(scraper_config['send_distribution_sums_as_monotonic'], scraper_config['send_monotonic_with_gauge'], '{}.sum'.format(self._metric_name_with_namespace(metric_name, scraper_config)), val, tags=tags, hostname=custom_hostname, flush_first_value=scraper_config['_successfully_executed'])
        elif sample[self.SAMPLE_NAME].endswith('_count'):
            tags = self._metric_tags(metric_name, val, sample, scraper_config, hostname=custom_hostname)
            self._submit_distribution_count(scraper_config['send_distribution_counts_as_monotonic'], scraper_config['send_monotonic_with_gauge'], '{}.count'.format(self._metric_name_with_namespace(metric_name, scraper_config)), val, tags=tags, hostname=custom_hostname, flush_first_value=scraper_config['_successfully_executed'])
        else:
            try:
                quantile = sample[self.SAMPLE_LABELS]['quantile']
            except KeyError:
                message = '"quantile" label not present in metric %r. Quantile-less summary metrics are not currently supported. Skipping...'
                self.log.debug(message, metric_name)
                continue
            sample[self.SAMPLE_LABELS]['quantile'] = str(float(quantile))
            tags = self._metric_tags(metric_name, val, sample, scraper_config, hostname=custom_hostname)
            self.gauge('{}.quantile'.format(self._metric_name_with_namespace(metric_name, scraper_config)), val, tags=tags, hostname=custom_hostname)
Extracts metrics from a prometheus summary metric and sends them as gauges
def _submit_gauges_from_summary(self, metric_name, metric, scraper_config, hostname=None):
    '\n        \n        '
    for sample in 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 self._ignore_metrics_by_label(scraper_config, metric_name, sample):
            continue
        custom_hostname = self._get_hostname(hostname, sample, scraper_config)
        if sample[self.SAMPLE_NAME].endswith('_sum'):
            tags = self._metric_tags(metric_name, val, sample, scraper_config, hostname=custom_hostname)
            self._submit_distribution_count(scraper_config['send_distribution_sums_as_monotonic'], scraper_config['send_monotonic_with_gauge'], '{}.sum'.format(self._metric_name_with_namespace(metric_name, scraper_config)), val, tags=tags, hostname=custom_hostname, flush_first_value=scraper_config['_successfully_executed'])
        elif sample[self.SAMPLE_NAME].endswith('_count'):
            tags = self._metric_tags(metric_name, val, sample, scraper_config, hostname=custom_hostname)
            self._submit_distribution_count(scraper_config['send_distribution_counts_as_monotonic'], scraper_config['send_monotonic_with_gauge'], '{}.count'.format(self._metric_name_with_namespace(metric_name, scraper_config)), val, tags=tags, hostname=custom_hostname, flush_first_value=scraper_config['_successfully_executed'])
        else:
            try:
                quantile = sample[self.SAMPLE_LABELS]['quantile']
            except KeyError:
                message = '"quantile" label not present in metric %r. Quantile-less summary metrics are not currently supported. Skipping...'
                self.log.debug(message, metric_name)
                continue
            sample[self.SAMPLE_LABELS]['quantile'] = str(float(quantile))
            tags = self._metric_tags(metric_name, val, sample, scraper_config, hostname=custom_hostname)
            self.gauge('{}.quantile'.format(self._metric_name_with_namespace(metric_name, scraper_config)), val, tags=tags, hostname=custom_hostname)