mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 13:03:29 +00:00
outgoing_webhook: Add a logging statement for each outgoing webhook.
This will help determine potentail timeout lengths, as well as serve as a generally-useful log for locations which do not have Smokescreen enabled. In service of #17742.
This commit is contained in:
committed by
Tim Abbott
parent
03e155f38a
commit
8711ab7676
@@ -1,6 +1,7 @@
|
||||
import abc
|
||||
import json
|
||||
import logging
|
||||
from time import perf_counter
|
||||
from typing import Any, AnyStr, Dict, Optional
|
||||
|
||||
import requests
|
||||
@@ -317,10 +318,18 @@ def do_rest_call(
|
||||
) -> Optional[Response]:
|
||||
"""Returns response of call if no exception occurs."""
|
||||
try:
|
||||
start_time = perf_counter()
|
||||
response = service_handler.make_request(
|
||||
base_url,
|
||||
event,
|
||||
)
|
||||
bot_profile = service_handler.user_profile
|
||||
logging.info(
|
||||
"Outgoing webhook request from %s@%s took %f seconds",
|
||||
bot_profile.id,
|
||||
bot_profile.realm.string_id,
|
||||
perf_counter() - start_time,
|
||||
)
|
||||
if not response:
|
||||
return None
|
||||
if str(response.status_code).startswith("2"):
|
||||
|
||||
Reference in New Issue
Block a user