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

Commit 251b556

Browse files
authored
Remove log_function and its uses (#11761)
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.
1 parent 47961ea commit 251b556

File tree

13 files changed

+1
-155
lines changed

13 files changed

+1
-155
lines changed

changelog.d/11761.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove `log_function` utility function and its uses.

synapse/federation/federation_client.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
from synapse.events import EventBase, builder
5757
from synapse.federation.federation_base import FederationBase, event_from_pdu_json
5858
from synapse.federation.transport.client import SendJoinResponse
59-
from synapse.logging.utils import log_function
6059
from synapse.types import JsonDict, get_domain_from_id
6160
from synapse.util.async_helpers import concurrently_execute
6261
from synapse.util.caches.expiringcache import ExpiringCache
@@ -144,7 +143,6 @@ def _clear_tried_cache(self) -> None:
144143
if destination_dict:
145144
self.pdu_destination_tried[event_id] = destination_dict
146145

147-
@log_function
148146
async def make_query(
149147
self,
150148
destination: str,
@@ -178,7 +176,6 @@ async def make_query(
178176
ignore_backoff=ignore_backoff,
179177
)
180178

181-
@log_function
182179
async def query_client_keys(
183180
self, destination: str, content: JsonDict, timeout: int
184181
) -> JsonDict:
@@ -196,7 +193,6 @@ async def query_client_keys(
196193
destination, content, timeout
197194
)
198195

199-
@log_function
200196
async def query_user_devices(
201197
self, destination: str, user_id: str, timeout: int = 30000
202198
) -> JsonDict:
@@ -208,7 +204,6 @@ async def query_user_devices(
208204
destination, user_id, timeout
209205
)
210206

211-
@log_function
212207
async def claim_client_keys(
213208
self, destination: str, content: JsonDict, timeout: int
214209
) -> JsonDict:

synapse/federation/federation_server.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
run_in_background,
5959
)
6060
from synapse.logging.opentracing import log_kv, start_active_span_from_edu, trace
61-
from synapse.logging.utils import log_function
6261
from synapse.metrics.background_process_metrics import wrap_as_background_process
6362
from synapse.replication.http.federation import (
6463
ReplicationFederationSendEduRestServlet,
@@ -859,7 +858,6 @@ async def on_event_auth(
859858
res = {"auth_chain": [a.get_pdu_json(time_now) for a in auth_pdus]}
860859
return 200, res
861860

862-
@log_function
863861
async def on_query_client_keys(
864862
self, origin: str, content: Dict[str, str]
865863
) -> Tuple[int, Dict[str, Any]]:
@@ -940,7 +938,6 @@ async def on_get_missing_events(
940938

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

943-
@log_function
944941
async def on_openid_userinfo(self, token: str) -> Optional[str]:
945942
ts_now_ms = self._clock.time_msec()
946943
return await self.store.get_user_id_for_open_id_token(token, ts_now_ms)

synapse/federation/persistence.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
from typing import Optional, Tuple
2424

2525
from synapse.federation.units import Transaction
26-
from synapse.logging.utils import log_function
2726
from synapse.storage.databases.main import DataStore
2827
from synapse.types import JsonDict
2928

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

39-
@log_function
4038
async def have_responded(
4139
self, origin: str, transaction: Transaction
4240
) -> Optional[Tuple[int, JsonDict]]:
@@ -53,7 +51,6 @@ async def have_responded(
5351

5452
return await self.store.get_received_txn_response(transaction_id, origin)
5553

56-
@log_function
5754
async def set_response(
5855
self, origin: str, transaction: Transaction, code: int, response: JsonDict
5956
) -> None:

0 commit comments

Comments
 (0)