mirror of
https://github.com/sprockets/sprockets-postgres.git
synced 2024-11-14 11:19:27 +00:00
Fix argument order for record_timing()
This commit is contained in:
parent
3dc8030c3e
commit
c53cf4f94b
2 changed files with 4 additions and 1 deletions
|
@ -709,7 +709,7 @@ class RequestHandlerMixin:
|
||||||
if hasattr(self, 'influxdb'): # sprockets-influxdb
|
if hasattr(self, 'influxdb'): # sprockets-influxdb
|
||||||
self.influxdb.set_field(metric_name, duration)
|
self.influxdb.set_field(metric_name, duration)
|
||||||
elif hasattr(self, 'record_timing'): # sprockets.mixins.metrics
|
elif hasattr(self, 'record_timing'): # sprockets.mixins.metrics
|
||||||
self.record_timing(metric_name, duration)
|
self.record_timing(duration, metric_name)
|
||||||
else:
|
else:
|
||||||
LOGGER.debug('Postgres query %s duration: %s',
|
LOGGER.debug('Postgres query %s duration: %s',
|
||||||
metric_name, duration)
|
metric_name, duration)
|
||||||
|
|
3
tests.py
3
tests.py
|
@ -344,6 +344,9 @@ class RequestHandlerMixinTestCase(TestCase):
|
||||||
self.assertEqual(response.code, 200)
|
self.assertEqual(response.code, 200)
|
||||||
self.assertEqual(json.loads(response.body)['value'], expectation)
|
self.assertEqual(json.loads(response.body)['value'], expectation)
|
||||||
self.app.record_timing.assert_called_once()
|
self.app.record_timing.assert_called_once()
|
||||||
|
duration, metric_name = self.app.record_timing.call_args[0]
|
||||||
|
self.assertGreater(duration, 0.0)
|
||||||
|
self.assertEqual('', metric_name)
|
||||||
|
|
||||||
def test_postgres_multirow_get(self):
|
def test_postgres_multirow_get(self):
|
||||||
response = self.fetch('/multi-row')
|
response = self.fetch('/multi-row')
|
||||||
|
|
Loading…
Reference in a new issue