tdb_sql: Up the number of frames in traceback.

tdb_sql has a lot of functions. Seven frames was frequently insufficient
to see who was phone.
This commit is contained in:
Neil Williams
2012-11-20 11:00:52 -08:00
parent f0310bc0af
commit f2894776db
3 changed files with 9 additions and 5 deletions

View File

@@ -369,7 +369,7 @@ def add_request_info(select):
def sanitize(txt):
return _spaces.sub(' ', txt).replace("/", "|").replace("-", "_").replace(';', "").replace("*", "").replace(r"/", "")
tb = simple_traceback()
tb = simple_traceback(limit=12)
try:
if (hasattr(request, 'path') and
hasattr(request, 'ip') and

View File

@@ -65,7 +65,7 @@ class MemcacheLock(object):
def acquire(self):
start = datetime.now()
my_info = (reddit_host, reddit_pid, simple_traceback())
my_info = (reddit_host, reddit_pid, simple_traceback(limit=7))
#if this thread already has this lock, move on
if self.key in self.locks:

View File

@@ -1401,10 +1401,14 @@ def parse_http_basic(authorization_header):
return require_split(auth_data, 2, ":")
def simple_traceback():
"""Generate a pared-down traceback that's human readable but small."""
def simple_traceback(limit):
"""Generate a pared-down traceback that's human readable but small.
stack_trace = traceback.extract_stack(limit=7)[:-2]
`limit` is how many frames of the stack to put in the traceback.
"""
stack_trace = traceback.extract_stack(limit=limit)[:-2]
return "\n".join(":".join((os.path.basename(filename),
function_name,
str(line_number),