File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5252 run_in_background ,
5353)
5454from synapse .logging .opentracing import start_active_span
55- from synapse .metrics import Histogram , LaterGauge
55+ from synapse .metrics import SERVER_NAME_LABEL , Histogram , LaterGauge
5656from synapse .util import Clock
5757
5858if typing .TYPE_CHECKING :
7575queue_wait_timer = Histogram (
7676 "synapse_rate_limit_queue_wait_time_seconds" ,
7777 "Amount of time spent waiting for the rate limiter to let our request through." ,
78- ["rate_limiter_name" ],
78+ labelnames = ["rate_limiter_name" , SERVER_NAME_LABEL ],
7979 buckets = (
8080 0.005 ,
8181 0.01 ,
@@ -279,7 +279,10 @@ def should_sleep(self) -> bool:
279279 async def _on_enter_with_tracing (self , request_id : object ) -> None :
280280 maybe_metrics_cm : ContextManager = contextlib .nullcontext ()
281281 if self .metrics_name :
282- maybe_metrics_cm = queue_wait_timer .labels (self .metrics_name ).time ()
282+ maybe_metrics_cm = queue_wait_timer .labels (
283+ rate_limiter_name = self .metrics_name ,
284+ ** {SERVER_NAME_LABEL : self .server_name },
285+ ).time ()
283286 with start_active_span ("ratelimit wait" ), maybe_metrics_cm :
284287 await self ._on_enter (request_id )
285288
You can’t perform that action at this time.
0 commit comments