diff options
author | Erik Johnston <erik@matrix.org> | 2021-06-16 13:29:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-16 13:29:54 +0100 |
commit | 36c426e294a53d2192cc9f29ec5c93e84e222228 (patch) | |
tree | 1fb8a65111212a563b372d4a6d741c289f25dcae | |
parent | Fix requestOpenIdToken response: integer expires_in (#10175) (diff) | |
download | synapse-36c426e294a53d2192cc9f29ec5c93e84e222228.tar.xz |
Add debug logging when we enter/exit Measure block (#10183)
It can be helpful to know when trying to track down slow requests.
-rw-r--r-- | changelog.d/10183.misc | 1 | ||||
-rw-r--r-- | synapse/util/metrics.py | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/changelog.d/10183.misc b/changelog.d/10183.misc new file mode 100644 index 0000000000..c0e01ad3db --- /dev/null +++ b/changelog.d/10183.misc @@ -0,0 +1 @@ +Add debug logging for when we enter and exit `Measure` blocks. diff --git a/synapse/util/metrics.py b/synapse/util/metrics.py index 6d14351bd2..45353d41c5 100644 --- a/synapse/util/metrics.py +++ b/synapse/util/metrics.py @@ -133,12 +133,17 @@ class Measure: self.start = self.clock.time() self._logging_context.__enter__() in_flight.register((self.name,), self._update_in_flight) + + logger.debug("Entering block %s", self.name) + return self def __exit__(self, exc_type, exc_val, exc_tb): if self.start is None: raise RuntimeError("Measure() block exited without being entered") + logger.debug("Exiting block %s", self.name) + duration = self.clock.time() - self.start usage = self.get_resource_usage() |