Add an environment variable to enable the spammy SQL diagnostics.

This commit is contained in:
Ben Rog-Wilhelm 2023-08-09 02:22:34 -05:00
parent 335f19f561
commit a4448b9a89

View file

@ -72,9 +72,10 @@ if environ.get("FLASK_PROFILER_ENDPOINT"):
profiler = flask_profiler.Profiler() profiler = flask_profiler.Profiler()
profiler.init_app(app) profiler.init_app(app)
# ...and then let's install code to unmangle jinja2 stacktraces for easy_profile... # ...and then let's set up the easy_profile analysis if it's enabled...
try: if bool_from_string(environ.get('DBG_SQL_ANALYSIS', False)):
try:
import inspect as inspectlib import inspect as inspectlib
import linecache import linecache
@ -106,7 +107,7 @@ try:
app.wsgi_app = EasyProfileMiddleware( app.wsgi_app = EasyProfileMiddleware(
app.wsgi_app, app.wsgi_app,
stack_callback = jinja_unmangle_stacktrace) stack_callback = jinja_unmangle_stacktrace)
except ModuleNotFoundError: except ModuleNotFoundError:
# failed to import, just keep on going # failed to import, just keep on going
pass pass