Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Remove log_function and its uses (#11761)
Browse files Browse the repository at this point in the history
I've never found this terribly useful. I think it was added in the early days
of Synapse, without much thought as to what would actually be useful to log,
and has just been cargo-culted ever since.

Rather, it tends to clutter up debug logs with useless information.
  • Loading branch information
richvdh committed Jan 18, 2022
1 parent 47961ea commit 251b556
Show file tree
Hide file tree
Showing 13 changed files with 1 addition and 155 deletions.
1 change: 1 addition & 0 deletions changelog.d/11761.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove `log_function` utility function and its uses.
5 changes: 0 additions & 5 deletions synapse/federation/federation_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
from synapse.events import EventBase, builder
from synapse.federation.federation_base import FederationBase, event_from_pdu_json
from synapse.federation.transport.client import SendJoinResponse
from synapse.logging.utils import log_function
from synapse.types import JsonDict, get_domain_from_id
from synapse.util.async_helpers import concurrently_execute
from synapse.util.caches.expiringcache import ExpiringCache
Expand Down Expand Up @@ -144,7 +143,6 @@ def _clear_tried_cache(self) -> None:
if destination_dict:
self.pdu_destination_tried[event_id] = destination_dict

@log_function
async def make_query(
self,
destination: str,
Expand Down Expand Up @@ -178,7 +176,6 @@ async def make_query(
ignore_backoff=ignore_backoff,
)

@log_function
async def query_client_keys(
self, destination: str, content: JsonDict, timeout: int
) -> JsonDict:
Expand All @@ -196,7 +193,6 @@ async def query_client_keys(
destination, content, timeout
)

@log_function
async def query_user_devices(
self, destination: str, user_id: str, timeout: int = 30000
) -> JsonDict:
Expand All @@ -208,7 +204,6 @@ async def query_user_devices(
destination, user_id, timeout
)

@log_function
async def claim_client_keys(
self, destination: str, content: JsonDict, timeout: int
) -> JsonDict:
Expand Down
3 changes: 0 additions & 3 deletions synapse/federation/federation_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
run_in_background,
)
from synapse.logging.opentracing import log_kv, start_active_span_from_edu, trace
from synapse.logging.utils import log_function
from synapse.metrics.background_process_metrics import wrap_as_background_process
from synapse.replication.http.federation import (
ReplicationFederationSendEduRestServlet,
Expand Down Expand Up @@ -859,7 +858,6 @@ async def on_event_auth(
res = {"auth_chain": [a.get_pdu_json(time_now) for a in auth_pdus]}
return 200, res

@log_function
async def on_query_client_keys(
self, origin: str, content: Dict[str, str]
) -> Tuple[int, Dict[str, Any]]:
Expand Down Expand Up @@ -940,7 +938,6 @@ async def on_get_missing_events(

return {"events": [ev.get_pdu_json(time_now) for ev in missing_events]}

@log_function
async def on_openid_userinfo(self, token: str) -> Optional[str]:
ts_now_ms = self._clock.time_msec()
return await self.store.get_user_id_for_open_id_token(token, ts_now_ms)
Expand Down
3 changes: 0 additions & 3 deletions synapse/federation/persistence.py
<
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
from typing import Optional, Tuple

from synapse.federation.units import Transaction
from synapse.logging.utils import log_function
from synapse.storage.databases.main import DataStore
from synapse.types import JsonDict

Expand All @@ -36,7 +35,6 @@ class TransactionActions:
def __init__(self, datastore: DataStore):
self.store = datastore

@log_function
async def have_responded(