mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
Add debug logging when we enter/exit Measure block (#10183)
It can be helpful to know when trying to track down slow requests.
This commit is contained in:
parent
2c240213f4
commit
36c426e294
1
changelog.d/10183.misc
Normal file
1
changelog.d/10183.misc
Normal file
@ -0,0 +1 @@
|
||||
Add debug logging for when we enter and exit `Measure` blocks.
|
@ -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()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user