def _uploadtraceback(ui, message, trace):
    key = "flat/errortrace-%(host)s-%(pid)s-%(time)s" % {
        "host": socket.gethostname(),
        "pid": os.getpid(),
        "time": time.time(),
    }

    payload = message + "\n\n" + trace
    # TODO: Move this into a background task that renders from
    # blackbox instead.
    ui.log("errortrace", "Trace:\n%s\n", trace, key=key, payload=payload)
    ui.log("errortracekey", "Trace key:%s\n", key, errortracekey=key)