|
75 | 75 | from synapse.events.snapshot import UnpersistedEventContext |
76 | 76 | from synapse.events.utils import copy_and_fixup_power_levels_contents |
77 | 77 | from synapse.handlers.relations import BundledAggregations |
| 78 | +from synapse.metrics import SERVER_NAME_LABEL |
78 | 79 | from synapse.rest.admin._base import assert_user_is_admin |
79 | 80 | from synapse.streams import EventSource |
80 | 81 | from synapse.types import ( |
|
112 | 113 | FIVE_MINUTES_IN_MS = 5 * 60 * 1000 |
113 | 114 |
|
114 | 115 |
|
115 | | -shutdown_time = Histogram("room_shutdown_time", "Time taken to shutdown rooms (sec)") |
| 116 | +shutdown_time = Histogram( |
| 117 | + "room_shutdown_time", |
| 118 | + "Time taken to shutdown rooms (sec)", |
| 119 | + labelnames=[SERVER_NAME_LABEL], |
| 120 | +) |
116 | 121 | shutdown_kick_count = Histogram( |
117 | 122 | "room_shutdown_kick_count", |
118 | 123 | "Number of users successfully kicked while shutting down a room", |
| 124 | + labelnames=[SERVER_NAME_LABEL], |
119 | 125 | ) |
120 | 126 | shutdown_failed_kick_count = Histogram( |
121 | 127 | "room_shutdown_failed_kick_count", |
122 | 128 | "Number of users that were failed to be kicked while shutting down a room", |
| 129 | + labelnames=[SERVER_NAME_LABEL], |
123 | 130 | ) |
124 | 131 |
|
125 | 132 |
|
@@ -2457,8 +2464,14 @@ async def shutdown_room( |
2457 | 2464 | result["local_aliases"] = [] |
2458 | 2465 |
|
2459 | 2466 | shutdown_end = time.time() |
2460 | | - shutdown_kick_count.observe(len(result["kicked_users"])) |
2461 | | - shutdown_failed_kick_count.observe(len(result["failed_to_kick_users"])) |
2462 | | - shutdown_time.observe(shutdown_end - shutdown_start) |
| 2467 | + shutdown_kick_count.labels(**{SERVER_NAME_LABEL: self.hs.hostname}).observe( |
| 2468 | + len(result["kicked_users"]) |
| 2469 | + ) |
| 2470 | + shutdown_failed_kick_count.labels( |
| 2471 | + **{SERVER_NAME_LABEL: self.hs.hostname} |
| 2472 | + ).observe(len(result["failed_to_kick_users"])) |
| 2473 | + shutdown_time.labels(**{SERVER_NAME_LABEL: self.hs.hostname}).observe( |
| 2474 | + shutdown_end - shutdown_start |
| 2475 | + ) |
2463 | 2476 |
|
2464 | 2477 | return result |
0 commit comments