Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 3dbc342

Browse files
committed
Remove python_twisted_reactor_pending_calls
I don't think it's terribly useful, and it is a bit of a pain to measure.
1 parent 45051e8 commit 3dbc342

File tree

1 file changed

+0
-24
lines changed

1 file changed

+0
-24
lines changed

Diff for: synapse/metrics/__init__.py

-24
Original file line numberDiff line numberDiff line change
@@ -377,11 +377,6 @@ def collect(self) -> Iterable[Metric]:
377377
"Tick time of the Twisted reactor (sec)",
378378
buckets=[0.001, 0.002, 0.005, 0.01, 0.025, 0.05, 0.1, 0.2, 0.5, 1, 2, 5],
379379
)
380-
pending_calls_metric = Histogram(
381-
"python_twisted_reactor_pending_calls",
382-
"Pending calls",
383-
buckets=[1, 2, 5, 10, 25, 50, 100, 250, 500, 1000],
384-
)
385380

386381
#
387382
# Federation Metrics
@@ -501,21 +496,6 @@ def collect(self) -> Iterable[Metric]:
501496
def runUntilCurrentTimer(reactor: ReactorBase, func: F) -> F:
502497
@functools.wraps(func)
503498
def f(*args: Any, **kwargs: Any) -> Any:
504-
now = reactor.seconds()
505-
num_pending = 0
506-
507-
# _newTimedCalls is one long list of *all* pending calls. Below loop
508-
# is based off of impl of reactor.runUntilCurrent
509-
for delayed_call in reactor._newTimedCalls:
510-
if delayed_call.time > now:
511-
break
512-
513-
if delayed_call.delayed_time > 0:
514-
continue
515-
516-
num_pending += 1
517-
518-
num_pending += len(reactor.threadCallQueue)
519499
start = time.time()
520500
ret = func(*args, **kwargs)
521501
end = time.time()
@@ -526,7 +506,6 @@ def f(*args: Any, **kwargs: Any) -> Any:
526506
# I/O events, but that is harder to capture without rewriting half the
527507
# reactor.
528508
tick_time.observe(end - start)
529-
pending_calls_metric.observe(num_pending)
530509

531510
# Update the time we last ticked, for the metric to test whether
532511
# Synapse's reactor has frozen
@@ -540,10 +519,7 @@ def f(*args: Any, **kwargs: Any) -> Any:
540519

541520
try:
542521
# Ensure the reactor has all the attributes we expect
543-
reactor.seconds # type: ignore
544522
reactor.runUntilCurrent # type: ignore
545-
reactor._newTimedCalls # type: ignore
546-
reactor.threadCallQueue # type: ignore
547523

548524
# runUntilCurrent is called when we have pending calls. It is called once
549525
# per iteratation after fd polling.

0 commit comments

Comments
 (0)