mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 10:00:01 -03:30
create performance logger to log api response time
this middleware allready existed, and we were trying to log this data but it was not working. Hope is these logs will be able to be shipped via external logging and we could use kibana to track response time of different endpoints
This commit is contained in:
parent
080c430b82
commit
0e6c14e707
@ -45,7 +45,10 @@ class TimingMiddleware(threading.local, MiddlewareMixin):
|
||||
response['X-API-Total-Time'] = '%0.3fs' % total_time
|
||||
if settings.AWX_REQUEST_PROFILE:
|
||||
response['X-API-Profile-File'] = self.prof.stop()
|
||||
perf_logger.info('api response times', extra=dict(python_objects=dict(request=request, response=response)))
|
||||
perf_logger.info(
|
||||
f'request: {request}, response_time: {response["X-API-Total-Time"]}',
|
||||
extra=dict(python_objects=dict(request=request, response=response, X_API_TOTAL_TIME=response["X-API-Total-Time"]))
|
||||
)
|
||||
return response
|
||||
|
||||
|
||||
|
||||
@ -1044,6 +1044,11 @@ LOGGING = {
|
||||
'level': 'INFO',
|
||||
'propagate': False
|
||||
},
|
||||
'awx.analytics.performance': {
|
||||
'handlers': ['console', 'file', 'tower_warnings', 'external_logger'],
|
||||
'level': 'DEBUG',
|
||||
'propagate': False
|
||||
},
|
||||
'awx.analytics.job_lifecycle': {
|
||||
'handlers': ['console', 'job_lifecycle'],
|
||||
'level': 'DEBUG',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user