chestarss opened a new issue #4934:
URL: https://github.com/apache/skywalking/issues/4934


   Please answer these questions before submitting your issue.
   
   - Why do you submit this issue?
   - [ ] Question or discussion
   - [x] Bug
   - [ ] Requirement
   - [ ] Feature or performance improvement
   
   ___
   ### Bug
   - Which version of SkyWalking, OS and JRE?
   skywalking 8.0
   skywalking-python  make install by HEAD/4c2109fda41
   
   - What happen?
   
   hooks.py 
   ```python
   from skywalking import agent, config
   
   def one_time_startup():
       config.init(collector='trace.domain.name:11800', service='mydjangoprj')
       agent.start()
   ```
   
   urls.py 
   ```python
   from mydjangoprj.hooks import one_time_startup
   ...
   urlpatterns.append(url(r'test/endpoint', views.TestView.as_view()))
   one_time_startup()
   ```
   views.py  call requests
   ```python
   ...
   class TestView(View):
       def post(self, request):
             ...
             resp = requests.get(url)
             ....
   ```
   
   ```shell
   curl http://127.0.0.1:8000/test/endpoint/
   ```
   ```python
       ...
       resp = requests.get(url)
     File 
"/home/admin/.virtualenvs/opssaas/lib/python3.6/site-packages/requests/api.py", 
line 70, in get
       return request('get', url, params=params, **kwargs)
     File 
"/home/admin/.virtualenvs/opssaas/lib/python3.6/site-packages/requests/api.py", 
line 56, in request
       return session.request(method=method, url=url, **kwargs)
     File 
"/home/admin/.virtualenvs/opssaas/lib/python3.6/site-packages/skywalking_python-0.1.1-py3.6.egg/skywalking/plugins/sw_requests/__init__.py",
 line 44, in _sw_request
       context = get_context()
     File 
"/home/admin/.virtualenvs/opssaas/lib/python3.6/site-packages/skywalking_python-0.1.1-py3.6.egg/skywalking/trace/context/__init__.py",
 line 123, in get_context
       _thread_local.context = _thread_local.context or (SpanContext() if 
agent.connected() else NoopContext())
   AttributeError: '_thread._local' object has no attribute 'context'
   
   ```
   
   
   ___
   ### Requirement or improvement
   - Please describe about your requirements or improvement suggestions.


----------------------------------------------------------------
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:
[email protected]


Reply via email to