|
38 | 38 | tag_args, |
39 | 39 | trace, |
40 | 40 | ) |
| 41 | +from synapse.metrics import SERVER_NAME_LABEL |
41 | 42 | from synapse.storage.databases.main.roommember import extract_heroes_from_room_summary |
42 | 43 | from synapse.storage.databases.main.state_deltas import StateDelta |
43 | 44 | from synapse.storage.databases.main.stream import PaginateFunction |
|
79 | 80 | sync_processing_time = Histogram( |
80 | 81 | "synapse_sliding_sync_processing_time", |
81 | 82 | "Time taken to generate a sliding sync response, ignoring wait times.", |
82 | | - ["initial"], |
| 83 | + labelnames=["initial", SERVER_NAME_LABEL], |
83 | 84 | ) |
84 | 85 |
|
85 | 86 | # Limit the number of state_keys we should remember sending down the connection for each |
|
94 | 95 |
|
95 | 96 | class SlidingSyncHandler: |
96 | 97 | def __init__(self, hs: "HomeServer"): |
| 98 | + self.server_name = hs.hostname |
97 | 99 | self.clock = hs.get_clock() |
98 | 100 | self.store = hs.get_datastores().main |
99 | 101 | self.storage_controllers = hs.get_storage_controllers() |
@@ -368,9 +370,9 @@ async def handle_room(room_id: str) -> None: |
368 | 370 | set_tag(SynapseTags.FUNC_ARG_PREFIX + "sync_config.user", user_id) |
369 | 371 |
|
370 | 372 | 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) |
374 | 376 |
|
375 | 377 | return sliding_sync_result |
376 | 378 |
|
|
0 commit comments