Skip to content

Commit a51c56a

Browse files
committed
fix bugs with request time header
1 parent 08e61c4 commit a51c56a

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

flask_queryinspect.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,6 @@ def after_request(self, response, *kw1, **kw2):
8888
else:
8989
response.headers['X-QueryInspect-Num-SQL-Queries'] = qi['reads'] + qi['writes']
9090
#response.headers['X-QueryInspect-Duplicate-SQL-Queries'] = qi['dupes']
91-
response.headers['X-QueryInspect-Total-SQL-Time'] = qi['q_time']
92-
response.headers['X-QueryInspect-Total-Request-Time'] = qi['r_time']
91+
response.headers['X-QueryInspect-Total-SQL-Time'] = qi['q_time_ms']
92+
response.headers['X-QueryInspect-Total-Request-Time'] = qi['r_time_ms']
9393
return response

test_queryinspect.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ def test_rtime(self):
6868
self.app.config['QUERYINSPECT_HEADERS_COMBINED'] = False
6969
with self.app.test_client() as c:
7070
res = c.get('/slow')
71+
log.debug(res.headers)
7172
r_time = float(res.headers['X-QueryInspect-Total-Request-Time'])
72-
self.assertTrue(90.0 < r_time > 110.0)
73+
log.debug('r_time: %r', r_time)
74+
self.assertTrue(90.0 < r_time < 110.0)
7375
self.app.config['QUERYINSPECT_HEADERS_COMBINED'] = True

0 commit comments

Comments
 (0)