def start_recording(env=None):
"""Start recording RPC traces.
This creates a Recorder instance and sets it for the current request
in the global RequestLocalRecorderProxy 'recorder_proxy'.
Args:
env: Optional WSGI environment; defaults to os.environ.
"""
recorder_proxy.clear_for_current_request()
if env is None:
env = os.environ
if not config.should_record(env):
return
if memcache.add(lock_key(), 0,
time=config.LOCK_TIMEOUT, namespace=config.KEY_NAMESPACE):
recorder_proxy.set_for_current_request(Recorder(env))
if config.DEBUG:
logging.debug('Set recorder')
评论列表
文章目录