Skip to content
Snippets Groups Projects
Unverified Commit 36c426e2 authored by Erik Johnston's avatar Erik Johnston Committed by GitHub
Browse files

Add debug logging when we enter/exit Measure block (#10183)

It can be helpful to know when trying to track down slow requests.
parent 2c240213
No related branches found
No related tags found
No related merge requests found
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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment