Merge "Check profiler instance before initialize"

This commit is contained in:
Zuul 2018-01-23 17:52:23 +00:00 committed by Gerrit Code Review
commit 252c14633a
1 changed files with 3 additions and 2 deletions

View File

@ -55,8 +55,9 @@ def init(hmac_key, base_id=None, parent_id=None):
:param parent_id: Used to build tree of traces.
:returns: Profiler instance
"""
__local_ctx.profiler = _Profiler(hmac_key, base_id=base_id,
parent_id=parent_id)
if get() is None:
__local_ctx.profiler = _Profiler(hmac_key, base_id=base_id,
parent_id=parent_id)
return __local_ctx.profiler