# Path: stackimpact/utils.py
# def timestamp():
#     return int(time.time())
# 
# def generate_uuid():
#     return str(uuid.uuid4())
# 
# def generate_sha1(text):
#     sha1_hash = hashlib.sha1()
#     sha1_hash.update(text.encode('utf-8'))
#     return sha1_hash.hexdigest()


import threading
import random
import math
from .utils import timestamp, generate_uuid, generate_sha1

        if ready:
            self.measurement = Measurement(
                generate_uuid(),
                trigger,
                value,
                duration,
                breakdown,
                timestamp())


    def to_dict(self):
        measurement_map = None
        if self.measurement:
            measurement_map = self.measurement.to_dict()

        metric_map = {
            'id': self.id,
            'type': self.typ,
            'category': self.category,
            'name': self.name,
            'unit': self.unit,
            'measurement': measurement_map,
        }

        return metric_map



class Measurement:

# Path: stackimpact/utils.py
# def timestamp():
#     return int(time.time())
# 
# def generate_uuid():
#     return str(uuid.uuid4())
# 
# def generate_sha1(text):
#     sha1_hash = hashlib.sha1()
#     sha1_hash.update(text.encode('utf-8'))
#     return sha1_hash.hexdigest()


# Path: stackimpact/metric.py
import threading
import random
import math
from .utils import timestamp, generate_uuid, generate_sha1


        if ready:
            self.measurement = Measurement(
                generate_uuid(),
                trigger,
                value,
                duration,
                breakdown,
                timestamp())


    def to_dict(self):
        measurement_map = None
        if self.measurement:
            measurement_map = self.measurement.to_dict()

        metric_map = {
            'id': self.id,
            'type': self.typ,
            'category': self.category,
            'name': self.name,
            'unit': self.unit,
            'measurement': measurement_map,
        }

        return metric_map



class Measurement:

    def __init__(self, id, trigger, value, duration, breakdown, timestamp):