Describe your environment
OS: MacOSX
Python version: 3.10
Package version: 0.60b1
What happened?
The Instrumentation Bug (init.py:334-369):
-
Line 334: _prepare_headers(kwargs) modifies kwargs in-place, setting kwargs["headers"]
-
Line 365: Injects tracing headers into that modified headers dict
-
Line 369: Calls wrapped(*args, **kwargs) with the modified kwargs
When urllib3's urlopen() makes a recursive call to itself (for retries, redirects, or connection pooling),
Python receives headers as BOTH:
Steps to Reproduce
We are using pinecone (pinecone[grpc]==7.0.0), which uses urlib3. This is a difficult bug to reproduce. We have only been able to recreate it in our production environment, so it might have something to do with the increased volume but we're not sure. However, we are pretty certain that we have uncovered what is going on (see the other section for more information).
Expected Result
We expected telemetry for urlib3 (used by Pinecone).
Actual Result
An error occurred. See a subset of the stacktrace here:
File "/usr/local/lib/python3.10/multiprocessing/pool.py", line 774, in get
raise self._value
File "/usr/local/lib/python3.10/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "/home/appuser/app/.venv/lib/python3.10/site-packages/pinecone/openapi_support/api_client.py", line 170, in __call_api
response_data = self.request(
File "/home/appuser/app/.venv/lib/python3.10/site-packages/pinecone/openapi_support/api_client.py", line 386, in request
return self.rest_client.POST(
File "/home/appuser/app/.venv/lib/python3.10/site-packages/pinecone/openapi_support/rest_utils.py", line 146, in POST
return self.request(
File "/home/appuser/app/.venv/lib/python3.10/site-packages/pinecone/openapi_support/rest_urllib3.py", line 190, in request
r = self.pool_manager.request(
File "/home/appuser/app/.venv/lib/python3.10/site-packages/urllib3/_request_methods.py", line 143, in request
return self.request_encode_body(
File "/home/appuser/app/.venv/lib/python3.10/site-packages/urllib3/_request_methods.py", line 278, in request_encode_body
return self.urlopen(method, url, **extra_kw)
File "/home/appuser/app/.venv/lib/python3.10/site-packages/urllib3/poolmanager.py", line 457, in urlopen
response = conn.urlopen(method, u.request_uri, **kw)
File "/home/appuser/app/.venv/lib/python3.10/site-packages/opentelemetry/instrumentation/urllib3/__init__.py", line 369, in instrumented_urlopen
response = wrapped(*args, **kwargs)
File "/home/appuser/app/.venv/lib/python3.10/site-packages/urllib3/connectionpool.py", line 942, in urlopen
return self.urlopen(
File "/home/appuser/app/.venv/lib/python3.10/site-packages/opentelemetry/instrumentation/urllib3/__init__.py", line 369, in instrumented_urlopen
response = wrapped(*args, **kwargs)
TypeError: HTTPConnectionPool.urlopen() got multiple values for argument 'headers'
Additional context
No response
Would you like to implement a fix?
None
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.
Describe your environment
OS: MacOSX
Python version: 3.10
Package version: 0.60b1
What happened?
The Instrumentation Bug (init.py:334-369):
Line 334: _prepare_headers(kwargs) modifies kwargs in-place, setting kwargs["headers"]
Line 365: Injects tracing headers into that modified headers dict
Line 369: Calls wrapped(*args, **kwargs) with the modified kwargs
When urllib3's urlopen() makes a recursive call to itself (for retries, redirects, or connection pooling),
Python receives headers as BOTH:
A positional argument (from args)
A keyword argument (from modified kwargs)
Steps to Reproduce
We are using pinecone (
pinecone[grpc]==7.0.0), which usesurlib3. This is a difficult bug to reproduce. We have only been able to recreate it in our production environment, so it might have something to do with the increased volume but we're not sure. However, we are pretty certain that we have uncovered what is going on (see the other section for more information).Expected Result
We expected telemetry for urlib3 (used by Pinecone).
Actual Result
An error occurred. See a subset of the stacktrace here:
Additional context
No response
Would you like to implement a fix?
None
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding
+1orme too, to help us triage it. Learn more here.