def _report(self, metric, metric_type, value, tags, sample_rate):
        """
        Create a metric packet and send it.

        More information about the packets' format: http://docs.datadoghq.com/guides/dogstatsd/
        """
        if value is None:
            return

        if sample_rate != 1 and random() > sample_rate:
            return

        payload = []

        # Resolve the full tag list
        if self.constant_tags:
            if tags:
                tags = tags + self.constant_tags
            else:
                tags = self.constant_tags

        # Create/format the metric packet
        if self.namespace:
            payload.extend([self.namespace, "."])
        payload.extend([metric, ":", value, "|", metric_type])

        if sample_rate != 1:
            payload.extend(["|@", sample_rate])

        if tags:
            payload.extend(["|#", ",".join(tags)])

        encoded = "".join(imap(str, payload))

        # Send it
        self._send(encoded)
dataset/ETHPy150Open DataDog/datadogpy/datadog/dogstatsd/base.py/DogStatsd._report/original