Sliding Sync: Prevent duplicate tags being added to traces (#17655)
Prevent duplicate tags being added to traces. Noticed because we see these warnings in Jaeger: <img width="462" alt="Screenshot 2024-09-03 at 2 34 05 PM" src="https://github.com/user-attachments/assets/6fac12ed-0074-435b-9451-eccde7e7012a">
This commit is contained in:
parent
dce38f3faf
commit
b054690c8c
|
@ -0,0 +1 @@
|
||||||
|
Prevent duplicate tags being added to Sliding Sync traces.
|
|
@ -449,6 +449,7 @@ class SlidingSyncHandler:
|
||||||
|
|
||||||
return state_map
|
return state_map
|
||||||
|
|
||||||
|
@trace
|
||||||
async def get_room_sync_data(
|
async def get_room_sync_data(
|
||||||
self,
|
self,
|
||||||
sync_config: SlidingSyncConfig,
|
sync_config: SlidingSyncConfig,
|
||||||
|
@ -839,13 +840,13 @@ class SlidingSyncHandler:
|
||||||
required_state_filter = StateFilter.all()
|
required_state_filter = StateFilter.all()
|
||||||
else:
|
else:
|
||||||
required_state_types: List[Tuple[str, Optional[str]]] = []
|
required_state_types: List[Tuple[str, Optional[str]]] = []
|
||||||
|
num_wild_state_keys = 0
|
||||||
|
lazy_load_room_members = False
|
||||||
|
num_others = 0
|
||||||
for (
|
for (
|
||||||
state_type,
|
state_type,
|
||||||
state_key_set,
|
state_key_set,
|
||||||
) in room_sync_config.required_state_map.items():
|
) in room_sync_config.required_state_map.items():
|
||||||
num_wild_state_keys = 0
|
|
||||||
lazy_load_room_members = False
|
|
||||||
num_others = 0
|
|
||||||
for state_key in state_key_set:
|
for state_key in state_key_set:
|
||||||
if state_key == StateValues.WILDCARD:
|
if state_key == StateValues.WILDCARD:
|
||||||
num_wild_state_keys += 1
|
num_wild_state_keys += 1
|
||||||
|
@ -877,19 +878,19 @@ class SlidingSyncHandler:
|
||||||
num_others += 1
|
num_others += 1
|
||||||
required_state_types.append((state_type, state_key))
|
required_state_types.append((state_type, state_key))
|
||||||
|
|
||||||
set_tag(
|
set_tag(
|
||||||
SynapseTags.FUNC_ARG_PREFIX
|
SynapseTags.FUNC_ARG_PREFIX
|
||||||
+ "required_state_wildcard_state_key_count",
|
+ "required_state_wildcard_state_key_count",
|
||||||
num_wild_state_keys,
|
num_wild_state_keys,
|
||||||
)
|
)
|
||||||
set_tag(
|
set_tag(
|
||||||
SynapseTags.FUNC_ARG_PREFIX + "required_state_lazy",
|
SynapseTags.FUNC_ARG_PREFIX + "required_state_lazy",
|
||||||
lazy_load_room_members,
|
lazy_load_room_members,
|
||||||
)
|
)
|
||||||
set_tag(
|
set_tag(
|
||||||
SynapseTags.FUNC_ARG_PREFIX + "required_state_other_count",
|
SynapseTags.FUNC_ARG_PREFIX + "required_state_other_count",
|
||||||
num_others,
|
num_others,
|
||||||
)
|
)
|
||||||
|
|
||||||
required_state_filter = StateFilter.from_types(required_state_types)
|
required_state_filter = StateFilter.from_types(required_state_types)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue