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:
Umair Khan
2017-02-10 09:42:41 +05:00
committed by Tim Abbott
parent 78768a2ba9
commit 7743f74180

View File

@@ -277,6 +277,10 @@ def process_instrumented_calls(func):
for call in INSTRUMENTED_CALLS:
func(call)
def append_instrumentation_data(data):
# type: (Dict[str, Any]) -> None
INSTRUMENTED_CALLS.append(data)
def instrument_url(f):
# type: (UrlFuncT) -> UrlFuncT
if not INSTRUMENTING:
@@ -293,7 +297,7 @@ def instrument_url(f):
else:
extra_info = ''
INSTRUMENTED_CALLS.append(dict(
append_instrumentation_data(dict(
url=url,
status_code=result.status_code,
method=f.__name__,