# Path: osprofiler/cmd/cliutils.py
# def env(*args, **kwargs):
# def arg(*args, **kwargs):
#     def _decorator(func):
# def add_arg(func, *args, **kwargs):
# 
# Path: osprofiler/drivers/base.py
# LOG = logging.getLogger(__name__)
# def get_driver(connection_string, *args, **kwargs):
#     def __init__(self, connection_str, project=None, service=None, host=None,
#                  **kwargs):
#     def notify(self, info, **kwargs):
#     def get_report(self, base_id):
#     def get_name(cls):
#     def list_traces(self, fields=None):
#     def list_error_traces(self):
#     def _build_tree(nodes):
#     def _append_results(self, trace_id, parent_id, name, project, service,
#                         host, timestamp, raw_payload=None):
#     def _parse_results(self):
#         def msec(dt):
# class Driver(object):
# 
# Path: osprofiler/exc.py
# class CommandError(Exception):
# class LogInsightAPIError(Exception):
# class LogInsightLoginTimeout(Exception):
#     def __init__(self, message=None):
#     def __str__(self):


import json
import os
import prettytable
            import graphviz
from oslo_utils import encodeutils
from oslo_utils import uuidutils
from osprofiler.cmd import cliutils
from osprofiler.drivers import base
from osprofiler import exc
            time_taken = info["finished"] - info["started"]
            service = info["service"] + ":" if "service" in info else ""
            name = info["name"]
            label = "%s%s - %d ms" % (service, name, time_taken)

            if name == "wsgi":
                req = info["meta.raw_payload.wsgi-start"]["info"]["request"]
                label = "%s\\n%s %s.." % (label, req["method"],
                                          req["path"][:30])
            elif name == "rpc" or name == "driver":
                raw = info["meta.raw_payload.%s-start" % name]
                fn_name = raw["info"]["function"]["name"]
                label = "%s\\n%s" % (label, fn_name.split(".")[-1])

            node_id = str(next_id[0])
            next_id[0] += 1
            dot.node(node_id, label)
            return node_id

        def _create_sub_graph(root):
            rid = _create_node(root["info"])
            for child in root["children"]:
                cid = _create_sub_graph(child)
                dot.edge(rid, cid)
            return rid

        _create_sub_graph(trace)
        return dot

    @cliutils.arg("--connection-string", dest="conn_str",

# Path: osprofiler/cmd/cliutils.py
# def env(*args, **kwargs):
# def arg(*args, **kwargs):
#     def _decorator(func):
# def add_arg(func, *args, **kwargs):
# 
# Path: osprofiler/drivers/base.py
# LOG = logging.getLogger(__name__)
# def get_driver(connection_string, *args, **kwargs):
#     def __init__(self, connection_str, project=None, service=None, host=None,
#                  **kwargs):
#     def notify(self, info, **kwargs):
#     def get_report(self, base_id):
#     def get_name(cls):
#     def list_traces(self, fields=None):
#     def list_error_traces(self):
#     def _build_tree(nodes):
#     def _append_results(self, trace_id, parent_id, name, project, service,
#                         host, timestamp, raw_payload=None):
#     def _parse_results(self):
#         def msec(dt):
# class Driver(object):
# 
# Path: osprofiler/exc.py
# class CommandError(Exception):
# class LogInsightAPIError(Exception):
# class LogInsightLoginTimeout(Exception):
#     def __init__(self, message=None):
#     def __str__(self):


# Path: osprofiler/cmd/commands.py
import json
import os
import prettytable
            import graphviz
from oslo_utils import encodeutils
from oslo_utils import uuidutils
from osprofiler.cmd import cliutils
from osprofiler.drivers import base
from osprofiler import exc

            time_taken = info["finished"] - info["started"]
            service = info["service"] + ":" if "service" in info else ""
            name = info["name"]
            label = "%s%s - %d ms" % (service, name, time_taken)

            if name == "wsgi":
                req = info["meta.raw_payload.wsgi-start"]["info"]["request"]
                label = "%s\\n%s %s.." % (label, req["method"],
                                          req["path"][:30])
            elif name == "rpc" or name == "driver":
                raw = info["meta.raw_payload.%s-start" % name]
                fn_name = raw["info"]["function"]["name"]
                label = "%s\\n%s" % (label, fn_name.split(".")[-1])

            node_id = str(next_id[0])
            next_id[0] += 1
            dot.node(node_id, label)
            return node_id

        def _create_sub_graph(root):
            rid = _create_node(root["info"])
            for child in root["children"]:
                cid = _create_sub_graph(child)
                dot.edge(rid, cid)
            return rid

        _create_sub_graph(trace)
        return dot

    @cliutils.arg("--connection-string", dest="conn_str",

                  default=cliutils.env("OSPROFILER_CONNECTION_STRING"),