Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ddtrace/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def send_traces(self, traces):
self._downgrade()
return self.send_traces(traces)

log.debug("reported %d spans in %.5fs", len(traces), time.time() - start)
log.debug("reported %d traces in %.5fs", len(traces), time.time() - start)
return response

def send_services(self, services):
Expand Down
9 changes: 8 additions & 1 deletion ddtrace/contrib/flask/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,17 @@ def _finish_span(self, response=None, exception=None):
# if we didn't get a response, but we did get an exception, set
# codes accordingly.
if not response and exception:
error = 1
code = 500
# The 3 next lines might not be strictly required, since `set_traceback`
# also get the exception from the sys.exc_info (and fill the error meta).
# Since we aren't sure it always work/for insuring no BC break, keep
# these lines which get overridden anyway.
error = 1
span.set_tag(errors.ERROR_TYPE, type(exception))
span.set_tag(errors.ERROR_MSG, exception)
# The provided `exception` object doesn't have a stack trace attached,
# so attach the stack trace with `set_traceback`.
span.set_traceback()

# the endpoint that matched the request is None if an exception
# happened so we fallback to a common resource
Expand Down
5 changes: 3 additions & 2 deletions tests/contrib/flask/test_flask.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import time
import logging
import os
import re

# 3p
from flask import Flask, render_template
Expand Down Expand Up @@ -260,8 +261,8 @@ def test_fatal(self):
eq_(s.meta.get(http.STATUS_CODE), '500')
eq_(s.meta.get(http.METHOD), 'GET')
assert "ZeroDivisionError" in s.meta.get(errors.ERROR_TYPE)
msg = s.meta.get(errors.ERROR_MSG)
assert "by zero" in msg, msg
assert "by zero" in s.meta.get(errors.ERROR_MSG)
assert re.search('File ".*/contrib/flask/test_flask.py", line [0-9]+, in fatal', s.meta.get(errors.ERROR_STACK))

def test_unicode(self):
start = time.time()
Expand Down