Add api node request servicer to response headers

This commit is contained in:
Matthew Jones 2016-10-07 10:55:06 -04:00
parent 594fa8cf89
commit 2a844b9c42

View File

@ -104,6 +104,7 @@ class APIView(views.APIView):
logger.warn(status_msg)
response = super(APIView, self).finalize_response(request, response, *args, **kwargs)
time_started = getattr(self, 'time_started', None)
response['X-API-Node'] = settings.CLUSTER_HOST_ID
if time_started:
time_elapsed = time.time() - self.time_started
response['X-API-Time'] = '%0.3fs' % time_elapsed