You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2020/11/24 18:01:42 UTC

[GitHub] [skywalking-python] tom-pytel commented on a change in pull request #89: [Enhancement] Async tasks should work 100%

tom-pytel commented on a change in pull request #89:
URL: https://github.com/apache/skywalking-python/pull/89#discussion_r529773910



##########
File path: skywalking/trace/context.py
##########
@@ -27,9 +25,52 @@
 from skywalking.utils.counter import Counter
 
 
+try:  # attempt to use async-local instead of thread-local context and spans
+    import contextvars
+
+    __local = contextvars.ContextVar('local')
+    __spans = contextvars.ContextVar('spans')  # this needs to be a per-task variable, can't be part of __local
+    _spans = __spans.get
+    _spans_set = __spans.set

Review comment:
       Never let a perfectly good piece of code get in the way of a proper linting I guess... Can you make this go away?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org