mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 03:44:52 -04:00
Merge branch 'master' into develop
This commit is contained in:
commit
6982db9651
11 changed files with 62 additions and 40 deletions
|
@ -104,7 +104,13 @@ class Measure:
|
|||
"start",
|
||||
]
|
||||
|
||||
def __init__(self, clock, name):
|
||||
def __init__(self, clock, name: str):
|
||||
"""
|
||||
Args:
|
||||
clock: A n object with a "time()" method, which returns the current
|
||||
time in seconds.
|
||||
name: The name of the metric to report.
|
||||
"""
|
||||
self.clock = clock
|
||||
self.name = name
|
||||
curr_context = current_context()
|
||||
|
@ -117,10 +123,8 @@ class Measure:
|
|||
else:
|
||||
assert isinstance(curr_context, LoggingContext)
|
||||
parent_context = curr_context
|
||||
self._logging_context = LoggingContext(
|
||||
"Measure[%s]" % (self.name,), parent_context
|
||||
)
|
||||
self.start = None
|
||||
self._logging_context = LoggingContext(str(curr_context), parent_context)
|
||||
self.start = None # type: Optional[int]
|
||||
|
||||
def __enter__(self) -> "Measure":
|
||||
if self.start is not None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue