Skip to content

log_request_success #391

@cp2587

Description

@cp2587

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions