def submit_openmetric(self, metric_name, metric, scraper_config, hostname=None):
    "\n        For each sample in the metric, report it as a gauge with all labels as tags\n        except if a labels `dict` is passed, in which case keys are label names we'll extract\n        and corresponding values are tag names we'll use (eg: {'node': 'node'}).\n\n        Histograms generate a set of values instead of a unique metric.\n        `send_histograms_buckets` is used to specify if you want to\n        send the buckets as tagged values when dealing with histograms.\n\n        `custom_tags` is an array of `tag:value` that will be added to the\n        metric when sending the gauge to Datadog.\n        "
    if (metric.type in ['gauge', 'counter', 'rate']):
        metric_name_with_namespace = self._metric_name_with_namespace(metric_name, scraper_config)
        for sample in metric.samples:
            if self._ignore_metrics_by_label(scraper_config, metric_name, sample):
                continue
            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
            custom_hostname = self._get_hostname(hostname, sample, scraper_config)
            tags = self._metric_tags(metric_name, val, sample, scraper_config, hostname=custom_hostname)
            if ((metric.type == 'counter') and scraper_config['send_monotonic_counter']):
                self.monotonic_count(metric_name_with_namespace, val, tags=tags, hostname=custom_hostname, flush_first_value=scraper_config['_successfully_executed'])
            elif (metric.type == 'rate'):
                self.rate(metric_name_with_namespace, val, tags=tags, hostname=custom_hostname)
            else:
                self.gauge(metric_name_with_namespace, val, tags=tags, hostname=custom_hostname)
                if ((metric.type == 'counter') and scraper_config['send_monotonic_with_gauge']):
                    self.monotonic_count((metric_name_with_namespace + '.total'), val, tags=tags, hostname=custom_hostname, flush_first_value=scraper_config['_successfully_executed'])
    elif (metric.type == 'histogram'):
        self._submit_gauges_from_histogram(metric_name, metric, scraper_config)
    elif (metric.type == 'summary'):
        self._submit_gauges_from_summary(metric_name, metric, scraper_config)
    else:
        self.log.error('Metric type %s unsupported for metric %s.', metric.type, metric_name)
For each sample in the metric, report it as a gauge with all labels as tags
except if a labels `dict` is passed, in which case keys are label names we'll extract
and corresponding values are tag names we'll use (eg: {'node': 'node'}).

Histograms generate a set of values instead of a unique metric.
`send_histograms_buckets` is used to specify if you want to
send the buckets as tagged values when dealing with histograms.

`custom_tags` is an array of `tag:value` that will be added to the
metric when sending the gauge to Datadog.
def submit_openmetric(self, metric_name, metric, scraper_config, hostname=None):
    "\n        For each sample in the metric, report it as a gauge with all labels as tags\n        except if a labels `dict` is passed, in which case keys are label names we'll extract\n        and corresponding values are tag names we'll use (eg: {'node': 'node'}).\n\n        Histograms generate a set of values instead of a unique metric.\n        `send_histograms_buckets` is used to specify if you want to\n        send the buckets as tagged values when dealing with histograms.\n\n        `custom_tags` is an array of `tag:value` that will be added to the\n        metric when sending the gauge to Datadog.\n        "
    if (metric.type in ['gauge', 'counter', 'rate']):
        metric_name_with_namespace = self._metric_name_with_namespace(metric_name, scraper_config)
        for sample in metric.samples:
            if self._ignore_metrics_by_label(scraper_config, metric_name, sample):
                continue
            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
            custom_hostname = self._get_hostname(hostname, sample, scraper_config)
            tags = self._metric_tags(metric_name, val, sample, scraper_config, hostname=custom_hostname)
            if ((metric.type == 'counter') and scraper_config['send_monotonic_counter']):
                self.monotonic_count(metric_name_with_namespace, val, tags=tags, hostname=custom_hostname, flush_first_value=scraper_config['_successfully_executed'])
            elif (metric.type == 'rate'):
                self.rate(metric_name_with_namespace, val, tags=tags, hostname=custom_hostname)
            else:
                self.gauge(metric_name_with_namespace, val, tags=tags, hostname=custom_hostname)
                if ((metric.type == 'counter') and scraper_config['send_monotonic_with_gauge']):
                    self.monotonic_count((metric_name_with_namespace + '.total'), val, tags=tags, hostname=custom_hostname, flush_first_value=scraper_config['_successfully_executed'])
    elif (metric.type == 'histogram'):
        self._submit_gauges_from_histogram(metric_name, metric, scraper_config)
    elif (metric.type == 'summary'):
        self._submit_gauges_from_summary(metric_name, metric, scraper_config)
    else:
        self.log.error('Metric type %s unsupported for metric %s.', metric.type, metric_name)