'For each metric in the message, 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 yes or no 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_metric(self, metric_name, message, send_histograms_buckets=True, custom_tags=None):

    if (message.type < len(self.METRIC_TYPES)):
        for metric in message.metric:
            if (message.type == 4):
                self._submit_gauges_from_histogram(metric_name, metric, send_histograms_buckets, custom_tags)
            elif (message.type == 2):
                self._submit_gauges_from_summary(metric_name, metric, custom_tags)
            else:
                val = getattr(metric, self.METRIC_TYPES[message.type]).value
                self._submit_gauge(metric_name, val, metric, custom_tags)
    else:
        self.log.error('Metric    type    {}    unsupported    for    metric    {}.'.format(message.type, message.name))
