- Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
We recently discovered that the 'log_request_success' method of the class Connection can slow down a query because of the following line:
tracer.debug('#[%s] (%.3fs)\n#%s', status_code, duration, _pretty_json(response).replace('\n', '\n#') if response else '').
If the user doesn't take care of its logging configuration ('elasticsearch' logger set to NOTSET for instance), this line will negatively impact the performance of the library. In our case, it was quite visible as we are working with a very heavy returned json (without the logging, overall the function was running in 2s, with it it took 6s !)
Maybe you should state somewhere in the docs to watch your logging configuration when doing some big query ? Also, for now we just set:
'elasticsearch': {'level': 'CRITICAL'}
In our logging dicConfig (https://docs.python.org/2/library/logging.config.html#logging.config.dictConfig), do you guys think it is enough to be sure to not have our performance impacted badly by any logging line of the library ?