You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ke...@apache.org on 2020/06/17 05:05:42 UTC

[skywalking-python] branch bugfix/threadlocal created (now 5c7fbdf)

This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a change to branch bugfix/threadlocal
in repository https://gitbox.apache.org/repos/asf/skywalking-python.git.


      at 5c7fbdf  Fix thread local context not init in Django and add upload command to Makefile

This branch includes the following new commits:

     new 5c7fbdf  Fix thread local context not init in Django and add upload command to Makefile

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[skywalking-python] 01/01: Fix thread local context not init in Django and add upload command to Makefile

Posted by ke...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch bugfix/threadlocal
in repository https://gitbox.apache.org/repos/asf/skywalking-python.git

commit 5c7fbdfdae62303342f08920a6fea2cdef3b4a67
Author: kezhenxu94 <ke...@163.com>
AuthorDate: Wed Jun 17 13:05:23 2020 +0800

    Fix thread local context not init in Django and add upload command to Makefile
---
 Makefile                             | 3 +++
 skywalking/trace/context/__init__.py | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/Makefile b/Makefile
index f41794b..b0566d5 100644
--- a/Makefile
+++ b/Makefile
@@ -48,6 +48,9 @@ install: gen
 package: clean gen
 	python3 setup.py sdist bdist_wheel
 
+upload-test:
+	twine upload --repository-url https://test.pypi.org/legacy/ dist/*
+
 clean:
 	rm -rf browser common language_agent management profile service_mesh_probe
 	rm -rf skywalking_python.egg-info dist build
diff --git a/skywalking/trace/context/__init__.py b/skywalking/trace/context/__init__.py
index 71beae6..dce8d68 100644
--- a/skywalking/trace/context/__init__.py
+++ b/skywalking/trace/context/__init__.py
@@ -120,6 +120,8 @@ _thread_local.context = None
 
 
 def get_context() -> SpanContext:
+    if not hasattr(_thread_local, 'context'):
+        _thread_local.context = None
     _thread_local.context = _thread_local.context or (SpanContext() if agent.connected() else NoopContext())
 
     return _thread_local.context