summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTovin Seven <vinhnt@vn.fujitsu.com>2018-01-18 15:22:07 +0700
committerTovin Seven <vinhnt@vn.fujitsu.com>2018-01-25 03:39:41 +0000
commit2eef34430671bac137a0e16d0d87197feb726464 (patch)
treea49302649cfd74c83321e8598d608d1a556bd4e5
parent41a6bc3fd4acf6b66865fc9e05a336dfc7f38704 (diff)
downloadosprofiler-queens-em.tar.gz
Check profiler instance before initializequeens-em1.15.2
Add a small check for this to an prevent issue in Nova [1] that causes some commands not working. [1] http://paste.openstack.org/show/641262/ Change-Id: I685386695e13bf5034a1008dbdcff4539eb482d2 Closes-Bug: #1743586 (cherry picked from commit 79e4e2de42e61556f6da251f351e56cadb07fe6d)
-rw-r--r--osprofiler/profiler.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/osprofiler/profiler.py b/osprofiler/profiler.py
index 001f62a..7b46b65 100644
--- a/osprofiler/profiler.py
+++ b/osprofiler/profiler.py
@@ -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