mirror of
https://github.com/zulip/zulip.git
synced 2025-11-18 12:54:58 +00:00
Do not append to INSTRMENTED_DATA directly.
Use append_instrumentation_data to append data to the INSTRUMENTED_DATA. This gives us a layer of abstraction when we need to add instrumentation data from other modules e.g. while running tests in parallel mode.
This commit is contained in:
@@ -277,6 +277,10 @@ def process_instrumented_calls(func):
|
|||||||
for call in INSTRUMENTED_CALLS:
|
for call in INSTRUMENTED_CALLS:
|
||||||
func(call)
|
func(call)
|
||||||
|
|
||||||
|
def append_instrumentation_data(data):
|
||||||
|
# type: (Dict[str, Any]) -> None
|
||||||
|
INSTRUMENTED_CALLS.append(data)
|
||||||
|
|
||||||
def instrument_url(f):
|
def instrument_url(f):
|
||||||
# type: (UrlFuncT) -> UrlFuncT
|
# type: (UrlFuncT) -> UrlFuncT
|
||||||
if not INSTRUMENTING:
|
if not INSTRUMENTING:
|
||||||
@@ -293,7 +297,7 @@ def instrument_url(f):
|
|||||||
else:
|
else:
|
||||||
extra_info = ''
|
extra_info = ''
|
||||||
|
|
||||||
INSTRUMENTED_CALLS.append(dict(
|
append_instrumentation_data(dict(
|
||||||
url=url,
|
url=url,
|
||||||
status_code=result.status_code,
|
status_code=result.status_code,
|
||||||
method=f.__name__,
|
method=f.__name__,
|
||||||
|
|||||||
Reference in New Issue
Block a user