mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
events: Add event types to logging.
This should make it a lot easier to analyze our events traffic and debug potential issues with it.
This commit is contained in:
@@ -536,7 +536,11 @@ def fetch_events(query):
|
|||||||
handler_id=handler_id) # type: Dict[str, Any]
|
handler_id=handler_id) # type: Dict[str, Any]
|
||||||
if orig_queue_id is None:
|
if orig_queue_id is None:
|
||||||
response['queue_id'] = queue_id
|
response['queue_id'] = queue_id
|
||||||
extra_log_data = "[%s/%s]" % (queue_id, len(response["events"]))
|
if len(response["events"]) == 1:
|
||||||
|
extra_log_data = "[%s/%s/%s]" % (queue_id, len(response["events"]),
|
||||||
|
response["events"][0]["type"])
|
||||||
|
else:
|
||||||
|
extra_log_data = "[%s/%s]" % (queue_id, len(response["events"]))
|
||||||
if was_connected:
|
if was_connected:
|
||||||
extra_log_data += " [was connected]"
|
extra_log_data += " [was connected]"
|
||||||
return dict(type="response", response=response, extra_log_data=extra_log_data)
|
return dict(type="response", response=response, extra_log_data=extra_log_data)
|
||||||
|
|||||||
@@ -35,7 +35,11 @@ def finish_handler(handler_id, event_queue_id, contents, apply_markdown):
|
|||||||
handler = get_handler_by_id(handler_id)
|
handler = get_handler_by_id(handler_id)
|
||||||
request = handler._request
|
request = handler._request
|
||||||
async_request_restart(request)
|
async_request_restart(request)
|
||||||
request._log_data['extra'] = "[%s/1]" % (event_queue_id,)
|
if len(contents) != 1:
|
||||||
|
request._log_data['extra'] = "[%s/1]" % (event_queue_id,)
|
||||||
|
else:
|
||||||
|
request._log_data['extra'] = "[%s/1/%s]" % (event_queue_id, contents[0]["type"])
|
||||||
|
|
||||||
handler.zulip_finish(dict(result='success', msg='',
|
handler.zulip_finish(dict(result='success', msg='',
|
||||||
events=contents,
|
events=contents,
|
||||||
queue_id=event_queue_id),
|
queue_id=event_queue_id),
|
||||||
|
|||||||
Reference in New Issue
Block a user