I ran into a small issue where the Flask integration is unable to set tags when they contain unicode characters.
The specific case we have is when unicode was in the url.
|
span.set_tag(http.URL, str(request.base_url or "")) |
2016-10-28 13:47:58,953 - ERROR - error finishing trace
Traceback (most recent call last):
File "/home/vagrant/.virtualenvs/kennel/local/lib/python2.7/site-packages/ddtrace/contrib/flask/middleware.py", line 150, in _request_finished
self._finish_span(response=response)
File "/home/vagrant/.virtualenvs/kennel/local/lib/python2.7/site-packages/ddtrace/contrib/flask/middleware.py", line 119, in _finish_span
span.set_tag(http.URL, str(request.base_url or ""))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe8' in position 31: ordinal not in range(128)
Happy to submit a PR for a fix, not sure how you would like to go about it, my thinking was:
from ...compat import stringify
# Use `stringify` instead of `str` throughout the module
span.set_tag(http.URL, stringify(request.base_url or ""))
I ran into a small issue where the Flask integration is unable to set tags when they contain unicode characters.
The specific case we have is when unicode was in the url.
dd-trace-py/ddtrace/contrib/flask/middleware.py
Line 119 in 8a9a7a5
Happy to submit a PR for a fix, not sure how you would like to go about it, my thinking was: