Feature Request: Return mock object from get_tracer() when inactive
Details
When running without viztracer, viztracer.get_tracer() returns None. This causes crashes when instrumentation code is present in the application but the tracer is not active.
It should instead return a mock or no-op object so that code execution continues without AttributeError.
Example:
The following code currently crashes if viztracer is not running:
# AttributeError: 'NoneType' object has no attribute 'log_event'
with get_tracer().log_event("scope"):
pass
Feature Request: Return mock object from
get_tracer()when inactiveDetails
When running without
viztracer,viztracer.get_tracer()returnsNone. This causes crashes when instrumentation code is present in the application but the tracer is not active.It should instead return a mock or no-op object so that code execution continues without
AttributeError.Example:
The following code currently crashes if
viztraceris not running: