mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
send_analytics_to_remote_server: Log connection errors with traceback.
It seems helpful for this to get logged with the traceback rather than just the general "<exception name> while trying to connect to push notification bouncer."
This commit is contained in:
committed by
Alex Vandiver
parent
55c0a15f1c
commit
cdd01b9f8e
@@ -161,7 +161,7 @@ def send_analytics_to_remote_server() -> None:
|
|||||||
try:
|
try:
|
||||||
result = send_to_push_bouncer("GET", "server/analytics/status", {})
|
result = send_to_push_bouncer("GET", "server/analytics/status", {})
|
||||||
except PushNotificationBouncerRetryLaterError as e:
|
except PushNotificationBouncerRetryLaterError as e:
|
||||||
logging.warning(e.msg)
|
logging.warning(e.msg, exc_info=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
last_acked_realm_count_id = result["last_realm_count_id"]
|
last_acked_realm_count_id = result["last_realm_count_id"]
|
||||||
|
@@ -571,13 +571,12 @@ class AnalyticsBouncerTest(BouncerTestCase):
|
|||||||
user = self.example_user("hamlet")
|
user = self.example_user("hamlet")
|
||||||
end_time = self.TIME_ZERO
|
end_time = self.TIME_ZERO
|
||||||
|
|
||||||
with responses.RequestsMock() as resp, mock.patch(
|
with responses.RequestsMock() as resp, self.assertLogs(level="WARNING") as mock_warning:
|
||||||
"zerver.lib.remote_server.logging.warning"
|
|
||||||
) as mock_warning:
|
|
||||||
resp.add(responses.GET, ANALYTICS_STATUS_URL, body=ConnectionError())
|
resp.add(responses.GET, ANALYTICS_STATUS_URL, body=ConnectionError())
|
||||||
send_analytics_to_remote_server()
|
send_analytics_to_remote_server()
|
||||||
mock_warning.assert_called_once_with(
|
self.assertIn(
|
||||||
"ConnectionError while trying to connect to push notification bouncer"
|
"WARNING:root:ConnectionError while trying to connect to push notification bouncer\nTraceback ",
|
||||||
|
mock_warning.output[0],
|
||||||
)
|
)
|
||||||
self.assertTrue(resp.assert_call_count(ANALYTICS_STATUS_URL, 1))
|
self.assertTrue(resp.assert_call_count(ANALYTICS_STATUS_URL, 1))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user