diff --git a/tomograph/config.py b/tomograph/config.py index 7b8439b..3b40cd6 100644 --- a/tomograph/config.py +++ b/tomograph/config.py @@ -29,6 +29,7 @@ zipkin_max_queue_length = 50000 zipkin_target_write_size = 1000 debug = False +db_tracing_enabled = True def set_backends(backends): """ diff --git a/tomograph/tomograph.py b/tomograph/tomograph.py index 404b95e..9724a5b 100644 --- a/tomograph/tomograph.py +++ b/tomograph/tomograph.py @@ -93,6 +93,8 @@ def traced(service_name, name, host='0.0.0.0', port=0): ## sqlalchemy event listeners def before_execute(name): def handler(conn, clauseelement, multiparams, params): + if not config.db_tracing_enabled: + return h = str(conn.connection.connection) a = h.find("'") b = h.find("'", a+1) @@ -110,6 +112,8 @@ def before_execute(name): def after_execute(name): # name isn't used, at least not yet... def handler(conn, clauseelement, multiparams, params, result): + if not config.db_tracing_enabled: + return stop('execute') pass return handler