open-telemetry / open-telemetry/opentelemetry-python-contrib
Requests accessing HTTPS prompt error maximum recurrence depth exceeded
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 1.1k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 16
Description
Describe your environment
OS: Ubuntu
Python version: Python 3.8.10
Package version: 0.46b0
What happened?
File "/opt/venv/lib/python3.8/site-packages/requests/api.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "/opt/venv/lib/python3.8/site-packages/requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "/opt/venv/lib/python3.8/site-packages/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "/opt/venv/lib/python3.8/site-packages/requests/sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "/opt/venv/lib/python3.8/site-packages/requests/adapters.py", line 439, in send
resp = conn.urlopen(
File "/opt/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 715, in urlopen
httplib_response = self._make_request(
File "/opt/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 404, in _make_request
self._validate_conn(conn)
File "/opt/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 1060, in validate_conn
conn.connect()
File "/opt/venv/lib/python3.8/site-packages/urllib3/connection.py", line 400, in connect
self.ssl_context = create_urllib3_context(
File "/opt/venv/lib/python3.8/site-packages/urllib3/util/ssl.py", line 312, in create_urllib3_context
context.options |= options
File "/usr/lib/python3.8/ssl.py", line 602, in options
super(SSLContext, SSLContext).options.set(self, value)
File "/usr/lib/python3.8/ssl.py", line 602, in options
super(SSLContext, SSLContext).options.set(self, value)
File "/usr/lib/python3.8/ssl.py", line 602, in options
super(SSLContext, SSLContext).options.set(self, value)
[Previous line repeated 452 more times]
RecursionError: maximum recursion depth exceeded
Steps to Reproduce
start script
OTEL_PYTHON_DISABLED_INSTRUMENTATIONS=requests,urllib3,urllib,boto3sqs
OTEL_TRACES_EXPORTER=otlp
OTEL_EXPORTER_OTLP_PROTOCOL=grpc
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=xxx
OTEL_RESOURCE_ATTRIBUTES=service.name=xx,service.version=1.0,service.xHawkUserSpaceId=258
/opt/venv/bin/opentelemetry-instrument --metrics_exporter none
/opt/venv/bin/gunicorn -D -c /opt/longan/gunicorn.py manage:app
Expected Result
Do not track requests when using the requests package to request HTTPS
Actual Result
I excluded the packages reqests and urllib3, but the error logs were still traced back to the error logs
Additional context
No response
Would you like to implement a fix?
None
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the provided gunicorn command with the requests and urllib3 instrumentations disabled, then trace the HTTPS failure through the reported requests, urllib3, and Python ssl.py stack frames. Done means HTTPS requests no longer produce the recursion error when those instrumentations are excluded.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- observability
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100