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()
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()
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) LOG.debug("OSProfiler has handled SQLAlchemy error: %s", original_exception)
def test_stop(self): p = profiler.init("secret", base_id="1", parent_id="2") p.stop = mock.MagicMock() profiler.stop(info="info") p.stop.assert_called_once_with(info="info")
def test_stop_not_inited(self): profiler._clean() profiler.stop()
def handler(conn, cursor, statement, params, context, executemany): profiler.stop()