mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 04:23:46 +00:00
Clean up slow log displays
(imported from commit cab99eeaef14e1f24a6b09b0cdbcdcc45bcb620a)
This commit is contained in:
@@ -138,15 +138,17 @@ class LogRequests(object):
|
|||||||
except Exception:
|
except Exception:
|
||||||
client = "?"
|
client = "?"
|
||||||
|
|
||||||
logger_line = '%-15s %-7s %3d %5s%s%s%s%s %s (%s via %s)' % \
|
logger_timing = '%5s%s%s%s%s %s (%s via %s)' % \
|
||||||
|
(format_timedelta(time_delta), optional_orig_delta,
|
||||||
|
memcached_output, bugdown_output,
|
||||||
|
db_time_output, request.get_full_path(), email, client)
|
||||||
|
logger_line = '%-15s %-7s %3d %s' % \
|
||||||
(remote_ip, request.method, response.status_code,
|
(remote_ip, request.method, response.status_code,
|
||||||
format_timedelta(time_delta), optional_orig_delta,
|
logger_timing)
|
||||||
memcached_output, bugdown_output,
|
|
||||||
db_time_output, request.get_full_path(), email, client)
|
|
||||||
logger.info(logger_line)
|
logger.info(logger_line)
|
||||||
|
|
||||||
if time_delta >= 1:
|
if time_delta >= 1:
|
||||||
queue_json_publish("slow_queries", logger_line, lambda e: None)
|
queue_json_publish("slow_queries", logger_timing, lambda e: None)
|
||||||
|
|
||||||
# Log some additional data whenever we return certain 40x errors
|
# Log some additional data whenever we return certain 40x errors
|
||||||
if 400 <= response.status_code < 500 and response.status_code not in [401, 404, 405]:
|
if 400 <= response.status_code < 500 and response.status_code not in [401, 404, 405]:
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ class SlowQueryWorker(QueueProcessingWorker):
|
|||||||
if len(slow_queries) > 0:
|
if len(slow_queries) > 0:
|
||||||
topic = "%s: slow queries" % (settings.STATSD_PREFIX,)
|
topic = "%s: slow queries" % (settings.STATSD_PREFIX,)
|
||||||
|
|
||||||
content = "Slow query report on %s:\n\n" % (settings.STATSD_PREFIX,)
|
content = ""
|
||||||
for query in slow_queries:
|
for query in slow_queries:
|
||||||
content += " %s\n" % (query,)
|
content += " %s\n" % (query,)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user