Skip to content
This repository has been archived by the owner on Jul 22, 2021. It is now read-only.

Commit

Permalink
Wrap status_code as a string
Browse files Browse the repository at this point in the history
  • Loading branch information
gmr committed Sep 2, 2014
1 parent fb43d6a commit c605621
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -29,7 +29,7 @@ def read_requirements_file(req_name):

setuptools.setup(
name='sprockets.mixins.statsd',
version='1.0.2',
version='1.0.3',
description='Handler mixins for automated metric reporting',
long_description=codecs.open('README.rst', encoding='utf-8').read(),
url='https://github.com/sprockets/sprockets.mixins.statsd.git',
Expand Down
6 changes: 3 additions & 3 deletions sprockets/mixins/statsd/__init__.py
Expand Up @@ -39,7 +39,7 @@ def get(self, *args, **kwargs):

from sprockets.clients import statsd

version_info = (1, 0, 2)
version_info = (1, 0, 3)
__version__ = '.'.join(str(v) for v in version_info)

STATSD_PREFIX = os.getenv('STATSD_PREFIX', 'sprockets')
Expand Down Expand Up @@ -73,12 +73,12 @@ def on_finish(self):
self.__module__,
self.__class__.__name__,
self.request.method,
self._status_code,
str(self._status_code),
value=self.request.request_time() * 1000)
statsd.incr(STATSD_PREFIX,
'counters',
self.__module__,
self.__class__.__name__,
self.request.method,
self._status_code)
str(self._status_code))
super(RequestMetricsMixin, self).on_finish()
5 changes: 3 additions & 2 deletions tests.py
Expand Up @@ -49,12 +49,13 @@ def test_on_finish_calls_statsd_add_timing(self, incr, add_timing):
self.duration = self.request._finish_time - self.request._start_time
self.handler.on_finish()
add_timing.assert_called_once_with('sprockets', 'timers', 'tests',
'StatsdRequestHandler', 'GET', 200,
'StatsdRequestHandler', 'GET',
'200',
value=self.duration * 1000)

@mock.patch('sprockets.clients.statsd.add_timing')
@mock.patch('sprockets.clients.statsd.incr')
def test_on_finish_calls_statsd_incr(self, incr, add_timing):
self.handler.on_finish()
incr.assert_called_once_with('sprockets', 'counters', 'tests',
'StatsdRequestHandler', 'GET', 200)
'StatsdRequestHandler', 'GET', '200')

0 comments on commit c605621

Please sign in to comment.