Skip to content


Subversion checkout URL

You can clone with
Download ZIP


TypeError when used with django statsd #354

jeromer opened this Issue · 1 comment

2 participants


When I use the toolbar and django statsd I get the following StackTrace:

File "/home/website/pyenv/lib/python2.7/site-packages/django/core/handlers/" in get_response
  188.                 response = middleware_method(request, response)
File "/home/website/pyenv/lib/python2.7/site-packages/django_statsd/" in process_response
  169.                 self.view_name,
File "/home/website/pyenv/lib/python2.7/site-packages/django_statsd/" in stop
  156.             cls.scope.timings.submit(*key)
File "/home/website/pyenv/lib/python2.7/site-packages/django_statsd/" in submit
  92.         client = self.get_client(*args)
File "/home/website/pyenv/lib/python2.7/site-packages/django_statsd/" in get_client
  47.         return utils.get_client(prefix, class_=self.class_)
File "/home/website/pyenv/lib/python2.7/site-packages/django_statsd/" in get_client
  18.         connection = get_connection()
File "/home/website/pyenv/lib/python2.7/site-packages/django_statsd/" in get_connection
  14.     return statsd.Connection(host, port, sample_rate)
File "/home/website/pyenv/lib/python2.7/site-packages/statsd/" in __init__
  36.             self._host, self._port, self._sample_rate)
File "/usr/lib/python2.7/logging/" in debug
  1136.             self._log(DEBUG, msg, args, **kwargs)
File "/usr/lib/python2.7/logging/" in _log
  1267.         self.handle(record)
File "/usr/lib/python2.7/logging/" in handle
  1277.             self.callHandlers(record)
File "/usr/lib/python2.7/logging/" in callHandlers
  1317.                     hdlr.handle(record)
File "/usr/lib/python2.7/logging/" in handle
  748.                 self.emit(record)
File "/home/website/pyenv/lib/python2.7/site-packages/debug_toolbar/panels/" in emit
  51.             'message': record.getMessage(),
File "/usr/lib/python2.7/logging/" in getMessage
  328.             msg = msg % self.args

Exception Type: TypeError at /
Exception Value: float argument required, not str

I tried to reorder middleware declarations but it changes nothing.

The only "fix" I found is to disable debug_toolbar.panels.logger.LoggingPanel.

The problem seems to appear when used with Apache mod_wsgi. I do not get this TypeError when running ./ --runserver.


  • Linux,
  • Python 2.7.3,
  • Django 1.4.3
  • python-statsd==1.5.7
  • django-debug-toolbar==0.9.4
  • Apache mod_wsgi

Looking at the stack trace, this appears to be a bug in django_statsd.

To confirm, I'd need the value of the record argument passed to ThreadTrackingHandler.emit just before the crash happens.

@aaugustin aaugustin closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.