implement sql-comment-string stack traces

Implements solution for bug 1007648.

Add python stack traces to all sql comment strings so that someone
looking at database query logs can immediately see what code
generated each query. This is especially powerful when combined
with pt-query-digest to get per-file or per-method aggregates.

Change-Id: Ieda5cf4d70cc2643d27fb00efb48de14ca2abe52
This commit is contained in:
Devananda van der Veen
2012-06-01 12:54:22 -07:00
parent ab6a2c5e94
commit 5ff4f3c016
2 changed files with 8 additions and 4 deletions

View File

@@ -51,6 +51,7 @@ David Subiros <david.perez5@hp.com>
Dean Troyer <dtroyer@gmail.com> Dean Troyer <dtroyer@gmail.com>
Deepak Garg <deepak.garg@citrix.com> Deepak Garg <deepak.garg@citrix.com>
Derek Higgins <derekh@redhat.com> Derek Higgins <derekh@redhat.com>
Devananda van der Veen <devananda.vdv@gmail.com>
Devdeep Singh <devdeep.singh@citrix.com> Devdeep Singh <devdeep.singh@citrix.com>
Devendra Modium <dmodium@isi.edu> Devendra Modium <dmodium@isi.edu>
Devin Carlen <devin.carlen@gmail.com> Devin Carlen <devin.carlen@gmail.com>

View File

@@ -94,10 +94,6 @@ core_opts = [
default='sqlite:///$state_path/$sqlite_db', default='sqlite:///$state_path/$sqlite_db',
help='The SQLAlchemy connection string used to connect to the ' help='The SQLAlchemy connection string used to connect to the '
'database'), 'database'),
cfg.IntOpt('sql_connection_debug',
default=0,
help='Verbosity of SQL debugging information. 0=None, '
'100=Everything'),
cfg.StrOpt('api_paste_config', cfg.StrOpt('api_paste_config',
default="api-paste.ini", default="api-paste.ini",
help='File name for the paste.deploy config for nova-api'), help='File name for the paste.deploy config for nova-api'),
@@ -120,6 +116,13 @@ debug_opts = [
cfg.BoolOpt('fake_network', cfg.BoolOpt('fake_network',
default=False, default=False,
help='If passed, use fake network devices and addresses'), help='If passed, use fake network devices and addresses'),
cfg.IntOpt('sql_connection_debug',
default=0,
help='Verbosity of SQL debugging information. 0=None, '
'100=Everything'),
cfg.BoolOpt('sql_connection_trace',
default=False,
help='Add python stack traces to SQL as comment strings'),
] ]
FLAGS.register_cli_opts(log_opts) FLAGS.register_cli_opts(log_opts)