Skip to content

Commit 68fa7ec

Browse files
committed
Fill in synapse/handlers/sliding_sync/__init__.py
1 parent 04b95ac commit 68fa7ec

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

synapse/handlers/sliding_sync/__init__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
tag_args,
3939
trace,
4040
)
41+
from synapse.metrics import SERVER_NAME_LABEL
4142
from synapse.storage.databases.main.roommember import extract_heroes_from_room_summary
4243
from synapse.storage.databases.main.state_deltas import StateDelta
4344
from synapse.storage.databases.main.stream import PaginateFunction
@@ -79,7 +80,7 @@
7980
sync_processing_time = Histogram(
8081
"synapse_sliding_sync_processing_time",
8182
"Time taken to generate a sliding sync response, ignoring wait times.",
82-
["initial"],
83+
labelnames=["initial", SERVER_NAME_LABEL],
8384
)
8485

8586
# Limit the number of state_keys we should remember sending down the connection for each
@@ -94,6 +95,7 @@
9495

9596
class SlidingSyncHandler:
9697
def __init__(self, hs: "HomeServer"):
98+
self.server_name = hs.hostname
9799
self.clock = hs.get_clock()
98100
self.store = hs.get_datastores().main
99101
self.storage_controllers = hs.get_storage_controllers()
@@ -368,9 +370,9 @@ async def handle_room(room_id: str) -> None:
368370
set_tag(SynapseTags.FUNC_ARG_PREFIX + "sync_config.user", user_id)
369371

370372
end_time_s = self.clock.time()
371-
sync_processing_time.labels(from_token is not None).observe(
372-
end_time_s - start_time_s
373-
)
373+
sync_processing_time.labels(
374+
initial=from_token is not None, **{SERVER_NAME_LABEL: self.server_name}
375+
).observe(end_time_s - start_time_s)
374376

375377
return sliding_sync_result
376378

0 commit comments

Comments
 (0)