def __init__(self, path, value, raw_value=None, timestamp=None, precision=0,
                 host=None, metric_type='COUNTER', ttl=None):
        """
        Create new instance of the Metric class

        Takes:
            path=string: string the specifies the path of the metric
            value=[float|int]: the value to be submitted
            timestamp=[float|int]: the timestamp, in seconds since the epoch
            (as from time.time()) precision=int: the precision to apply.
            Generally the default (2) should work fine.
        """

        # Validate the path, value and metric_type submitted
        if (None in [path, value] or metric_type not in ('COUNTER', 'GAUGE')):
            raise DiamondException(("Invalid parameter when creating new "
                                    "Metric with path: %r value: %r "
                                    "metric_type: %r")
                                   % (path, value, metric_type))

        # If no timestamp was passed in, set it to the current time
        if timestamp is None:
            timestamp = int(time.time())
        else:
            # If the timestamp isn't an int, then make it one
            if not isinstance(timestamp, int):
                try:
                    timestamp = int(timestamp)
                except ValueError as e:
                    raise DiamondException(("Invalid timestamp when "
                                            "creating new Metric %r: %s")
                                           % (path, e))

        # The value needs to be a float or an int.  If it is, great.  If not,
        # try to cast it to one of those.
        if not isinstance(value, (int, float)):
            try:
                if precision == 0:
                    value = round(float(value))
                else:
                    value = float(value)
            except __HOLE__ as e:
                raise DiamondException(("Invalid value when creating new "
                                        "Metric %r: %s") % (path, e))

        self.path = path
        self.value = value
        self.raw_value = raw_value
        self.timestamp = timestamp
        self.precision = precision
        self.host = host
        self.metric_type = metric_type
        self.ttl = ttl
dataset/ETHPy150Open python-diamond/Diamond/src/diamond/metric.py/Metric.__init__