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

Tag /send_join responses to detect faster joins #14950

Merged
merged 4 commits into from
Jan 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/14950.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Faster joins: tag `v2/send_join/` requests to indicate if they served a partial join response.
6 changes: 6 additions & 0 deletions synapse/federation/federation_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@
run_in_background,
)
from synapse.logging.opentracing import (
SynapseTags,
log_kv,
set_tag,
start_active_span_from_edu,
tag_args,
trace,
Expand Down Expand Up @@ -678,6 +680,10 @@ async def on_send_join_request(
room_id: str,
caller_supports_partial_state: bool = False,
) -> Dict[str, Any]:
set_tag(
SynapseTags.SEND_JOIN_RESPONSE_IS_PARTIAL_STATE,
caller_supports_partial_state,
)
await self._room_member_handler._join_rate_per_room_limiter.ratelimit( # type: ignore[has-type]
requester=None,
key=room_id,
Expand Down
5 changes: 5 additions & 0 deletions synapse/logging/opentracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,11 @@ class SynapseTags:
# The name of the external cache
CACHE_NAME = "cache.name"

# Boolean. Present on /v2/send_join requests, omitted from all others.
# True iff partial state was requested and we provided (or intended to provide)
# partial state in the response.
SEND_JOIN_RESPONSE_IS_PARTIAL_STATE = "send_join.partial_state_response"

# Used to tag function arguments
#
# Tag a named arg. The name of the argument should be appended to this prefix.
Expand Down