Changes between Version 1 and Version 2 of Ticket #25704
- Timestamp:
- Nov 7, 2015, 1:35:25 PM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #25704
- Property Triage Stage Accepted → Unreviewed
-
Ticket #25704 – Description
v1 v2 19 19 }}} 20 20 21 or via middleware 22 23 {{{ 24 #!python 25 class ResponseTimeMiddleware(object): 26 def process_view(self, request, view_func, view_args, view_kwargs): 27 start = time.time() 28 response = view_func(request, *view_args, **view_kwargs) 29 30 if response and getattr(response, 'is_rendered', True) is False: 31 response.rendered_content 32 33 logging.getLogger('response_time').debug( 34 'Response time %dms', (time.time() - start) * 1000) 35 return response 36 }}} 37 38 21 39 It seems easy to add it in the WSGIRequestHandler e.g. https://github.com/django/django/pull/5606. The response time is slightly longer than actual response time due to late measuring but think an easy implementation is better than the exact duration. 22 40