# Path: osprofiler/profiler.py
# def clean():
# def _ensure_no_multiple_traced(traceable_attrs):
# def init(hmac_key, base_id=None, parent_id=None):
# def get():
# def start(name, info=None):
# def stop(info=None):
# def trace(name, info=None, hide_args=False, hide_result=True,
#           allow_multiple_trace=True):
#     def decorator(f):
#         def wrapper(*args, **kwargs):
# def trace_cls(name, info=None, hide_args=False, hide_result=True,
#               trace_private=False, allow_multiple_trace=True,
#               trace_class_methods=False, trace_static_methods=False):
#     def trace_checker(attr_name, to_be_wrapped):
#     def decorator(cls):
#     def __init__(cls, cls_name, bases, attrs):
#     def __init__(self, name, info=None):
#     def __enter__(self):
#     def __exit__(self, etype, value, traceback):
#     def __init__(self, hmac_key, base_id=None, parent_id=None):
#     def get_shorten_id(self, uuid_id):
#     def get_base_id(self):
#     def get_parent_id(self):
#     def get_id(self):
#     def start(self, name, info=None):
#     def stop(self, info=None):
#     def _notify(self, name, info):
# class TracedMeta(type):
# class Trace(object):
# class _Profiler(object):


import contextlib
import logging as log
from oslo_utils import reflection
from osprofiler import profiler
    def handler(conn, cursor, statement, params, context, executemany):
        if not hide_result:
            # Add SQL result to trace info in *-stop phase
            info = {
                "db": {
                    "result": str(cursor._rows)
                }
            }
            profiler.stop(info=info)
        else:
            profiler.stop()

    return handler


def handle_error(exception_context):
    """Handle SQLAlchemy errors"""
    exception_class_name = reflection.get_class_name(
        exception_context.original_exception)
    original_exception = str(exception_context.original_exception)
    chained_exception = str(exception_context.chained_exception)

    info = {
        "etype": exception_class_name,
        "message": original_exception,
        "db": {
            "original_exception": original_exception,
            "chained_exception": chained_exception
        }
    }

# Path: osprofiler/profiler.py
# def clean():
# def _ensure_no_multiple_traced(traceable_attrs):
# def init(hmac_key, base_id=None, parent_id=None):
# def get():
# def start(name, info=None):
# def stop(info=None):
# def trace(name, info=None, hide_args=False, hide_result=True,
#           allow_multiple_trace=True):
#     def decorator(f):
#         def wrapper(*args, **kwargs):
# def trace_cls(name, info=None, hide_args=False, hide_result=True,
#               trace_private=False, allow_multiple_trace=True,
#               trace_class_methods=False, trace_static_methods=False):
#     def trace_checker(attr_name, to_be_wrapped):
#     def decorator(cls):
#     def __init__(cls, cls_name, bases, attrs):
#     def __init__(self, name, info=None):
#     def __enter__(self):
#     def __exit__(self, etype, value, traceback):
#     def __init__(self, hmac_key, base_id=None, parent_id=None):
#     def get_shorten_id(self, uuid_id):
#     def get_base_id(self):
#     def get_parent_id(self):
#     def get_id(self):
#     def start(self, name, info=None):
#     def stop(self, info=None):
#     def _notify(self, name, info):
# class TracedMeta(type):
# class Trace(object):
# class _Profiler(object):


# Path: osprofiler/sqlalchemy.py
import contextlib
import logging as log
from oslo_utils import reflection
from osprofiler import profiler

    def handler(conn, cursor, statement, params, context, executemany):
        if not hide_result:
            # Add SQL result to trace info in *-stop phase
            info = {
                "db": {
                    "result": str(cursor._rows)
                }
            }
            profiler.stop(info=info)
        else:
            profiler.stop()

    return handler


def handle_error(exception_context):
    """Handle SQLAlchemy errors"""
    exception_class_name = reflection.get_class_name(
        exception_context.original_exception)
    original_exception = str(exception_context.original_exception)
    chained_exception = str(exception_context.chained_exception)

    info = {
        "etype": exception_class_name,
        "message": original_exception,
        "db": {
            "original_exception": original_exception,
            "chained_exception": chained_exception
        }
    }

    profiler.stop(info=info)