diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2022-01-19 11:50:09 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-19 16:50:09 +0000 |
commit | c072c0b82969879cd08d0d6e669ded509f1e833b (patch) | |
tree | 18604e1a856ef5c16c5d880e1c824ffade6c5fe7 | |
parent | Add missing `auto_attribs=True` to the `_WrappedRustReporter` class (#11768) (diff) | |
download | synapse-c072c0b82969879cd08d0d6e669ded509f1e833b.tar.xz |
Fix mypy for platforms without epoll support. (#11771)
Diffstat (limited to '')
-rw-r--r-- | changelog.d/11771.misc | 1 | ||||
-rw-r--r-- | synapse/metrics/_reactor_metrics.py | 4 |
2 files changed, 3 insertions, 2 deletions
diff --git a/changelog.d/11771.misc b/changelog.d/11771.misc new file mode 100644 index 0000000000..e9d5dae857 --- /dev/null +++ b/changelog.d/11771.misc @@ -0,0 +1 @@ +Improve accuracy of `python_twisted_reactor_tick_time` prometheus metric. diff --git a/synapse/metrics/_reactor_metrics.py b/synapse/metrics/_reactor_metrics.py index ce0688621c..f38f798313 100644 --- a/synapse/metrics/_reactor_metrics.py +++ b/synapse/metrics/_reactor_metrics.py @@ -35,7 +35,7 @@ tick_time = Histogram( class EpollWrapper: """a wrapper for an epoll object which records the time between polls""" - def __init__(self, poller: "select.epoll"): + def __init__(self, poller: "select.epoll"): # type: ignore[name-defined] self.last_polled = time.time() self._poller = poller @@ -71,7 +71,7 @@ try: # if the reactor has a `_poller` attribute, which is an `epoll` object # (ie, it's an EPollReactor), we wrap the `epoll` with a thing that will # measure the time between ticks - from select import epoll + from select import epoll # type: ignore[attr-defined] poller = reactor._poller # type: ignore[attr-defined] except (AttributeError, ImportError): |