Add python stack trace to SQL comment strings

Bug #1007648 reported by aeva black
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
aeva black

Bug Description

It would be helpful to inject a pseudo-stack-trace showing the relevant parts of the python call stack into a SQL comment string in each database query. This could be used for debugging transactional issues (my current focus), or other debugging tasks. It could also be aggregated by pt-query-digest to analyze database activity coming from different sections of the nova code.

This can be done by monkey-patching the database driver when the sql_connection_debug option is set at a certain level.

Tags: db
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/8070

Changed in nova:
assignee: nobody → Devananda (devananda)
status: New → In Progress
Revision history for this message
aeva black (tenbrae) wrote :

To enable the above code in devstack, add this to your localrc:

EXTRA_OPTS=(sql_connection_debug=20)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/8070
Committed: http://github.com/openstack/nova/commit/ad0031c7fbfd0461b4b804b3a75a48212d5c9e9f
Submitter: Jenkins
Branch: master

commit ad0031c7fbfd0461b4b804b3a75a48212d5c9e9f
Author: Devananda van der Veen <email address hidden>
Date: Fri Jun 1 12:54:22 2012 -0700

    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

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → folsom-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: folsom-2 → 2012.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.