(
        self,
        metric_name,
        message,
        send_histograms_buckets=True,
        send_monotonic_counter=False,
        custom_tags=None,
        hostname=None,
    )
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.
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'}).
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 } ) .
def _submit(
        self,
        metric_name,
        message,
        send_histograms_buckets=True,
        send_monotonic_counter=False,
        custom_tags=None,
        hostname=None,
    ):
        """
        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.
        """
        if message.type < len(self.METRIC_TYPES):
            for metric in message.metric:
                custom_hostname = self._get_hostname(hostname, metric)
                if message.type == 0:
                    val = getattr(metric, self.METRIC_TYPES[message.type]).value
                    if self._is_value_valid(val):
                        if send_monotonic_counter:
                            self._submit_monotonic_count(metric_name, val, metric, custom_tags, custom_hostname)
                        else:
                            self._submit_gauge(metric_name, val, metric, custom_tags, custom_hostname)
                    else:
                        self.log.debug("Metric value is not supported for metric %s.", metric_name)
                elif message.type == 4:
                    self._submit_gauges_from_histogram(
                        metric_name, metric, send_histograms_buckets, custom_tags, custom_hostname
                    )
                elif message.type == 2:
                    self._submit_gauges_from_summary(metric_name, metric, custom_tags, custom_hostname)
                else:
                    val = getattr(metric, self.METRIC_TYPES[message.type]).value
                    if self._is_value_valid(val):
                        if message.name in self.rate_metrics:
                            self._submit_rate(metric_name, val, metric, custom_tags, custom_hostname)
                        else:
                            self._submit_gauge(metric_name, val, metric, custom_tags, custom_hostname)
                    else:
                        self.log.debug("Metric value is not supported for metric %s.", metric_name)

        else:
            self.log.error("Metric type %s unsupported for metric %s.", message.type, message.name)
def _submit ( self , metric_name , message , send_histograms_buckets = True , send_monotonic_counter = False , custom_tags = None , hostname = None , ) : if message . type < len ( self . METRIC_TYPES ) : for metric in message . metric : custom_hostname = self . _get_hostname ( hostname , metric ) if message . type == 0 : val = getattr ( metric , self . METRIC_TYPES [ message . type ] ) . value if self . _is_value_valid ( val ) : if send_monotonic_counter : self . _submit_monotonic_count ( metric_name , val , metric , custom_tags , custom_hostname ) else : self . _submit_gauge ( metric_name , val , metric , custom_tags , custom_hostname ) else : self . log . debug ( "Metric value is not supported for metric %s." , metric_name ) elif message . type == 4 : self . _submit_gauges_from_histogram ( metric_name , metric , send_histograms_buckets , custom_tags , custom_hostname ) elif message . type == 2 : self . _submit_gauges_from_summary ( metric_name , metric , custom_tags , custom_hostname ) else : val = getattr ( metric , self . METRIC_TYPES [ message . type ] ) . value if self . _is_value_valid ( val ) : if message . name in self . rate_metrics : self . _submit_rate ( metric_name , val , metric , custom_tags , custom_hostname ) else : self . _submit_gauge ( metric_name , val , metric , custom_tags , custom_hostname ) else : self . log . debug ( "Metric value is not supported for metric %s." , metric_name ) else : self . log . error ( "Metric type %s unsupported for metric %s." , message . type , message . name )