# HG changeset patch # User Marcin Kuzminski # Date 2018-02-02 18:48:03 # Node ID 81644cd56ffff1ca32f54f52af897ec1db4ad3db # Parent eadb9ab2104fb0c914129d068cd3d3f6cd5b8f87 gunicorn: show total gunicorn execution time, and worker counter base on the gunicorn_conf.py diff --git a/configs/gunicorn_config.py b/configs/gunicorn_config.py --- a/configs/gunicorn_config.py +++ b/configs/gunicorn_config.py @@ -119,16 +119,16 @@ def child_exit(server, worker): def pre_request(worker, req): - return - worker.log.debug("[<%-10s>] PRE WORKER: %s %s", - worker.pid, req.method, req.path) + worker.start_time = time.time() + worker.log.debug( + "GNCRN PRE WORKER: %s %s", req.method, req.path) def post_request(worker, req, environ, resp): - return - worker.log.debug("[<%-10s>] POST WORKER: %s %s resp: %s", worker.pid, - req.method, req.path, resp.status_code) - + total_time = time.time() - worker.start_time + worker.log.debug( + "GNCRN POST WORKER [cnt:%s]: %s %s resp: %s, Load Time: %.3fs", + worker.nr, req.method, req.path, resp.status_code, total_time) class RhodeCodeLogger(Logger):