Describe your environment
OS: Ubuntu 22.04 (Linux 6.8.0-138-generic, x86_64)
Python version: 3.12.12
SDK version: 1.45.0 (1.44.0 for the working run)
API version: 1.45.0 (1.44.0 for the working run)
uv: 0.9.13
What happened?
After upgrading from 1.44.0 to 1.45.0, the OTLP HTTP span exporter no longer uses the proxy set in HTTPS_PROXY. It resolves and connects to the endpoint directly. In our environment the collector is only reachable through a proxy, so every export fails.
This appears to come from #5389 ("switch default HTTP backend to urllib3"). The new default urllib3 transport doesn't read proxy environment variables, while the previous requests-based transport did. The 1.45.0 changelog doesn't mention this.
Steps to Reproduce
repro.py:
import os, socket, threading
# Send HTTPS through a local fake proxy and ignore any proxy settings from the shell.
for var in ("http_proxy", "HTTP_PROXY", "all_proxy", "ALL_PROXY", "no_proxy", "NO_PROXY"):
os.environ.pop(var, None)
os.environ["HTTPS_PROXY"] = os.environ["https_proxy"] = "http://127.0.0.1:3129"
# Fake proxy: record the first line of each request and close the connection.
srv = socket.create_server(("127.0.0.1", 3129))
seen = []
def accept_loop():
while True:
conn, _ = srv.accept()
seen.append(conn.recv(1024).split(b"\r\n")[0])
conn.close()
threading.Thread(target=accept_loop, daemon=True).start()
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import SimpleSpanProcessor
provider = TracerProvider()
provider.add_span_processor(
SimpleSpanProcessor(OTLPSpanExporter(endpoint="https://collector.invalid/v1/traces", timeout=2))
)
provider.get_tracer(__name__).start_span("span").end()
print("proxy received:", seen)
uv run --no-project --with 'opentelemetry-exporter-otlp-proto-http==1.44.0' python repro.py
uv run --no-project --with 'opentelemetry-exporter-otlp-proto-http==1.45.0' python repro.py
The fake proxy only records the request line and closes the connection, so both runs end in a connection error. The difference is whether the exporter uses the proxy at all.
Expected Result
The exporter sends the request through the proxy, as 1.44.0 does:
Transient error ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) encountered while exporting span batch, retrying in 0.90s.
Failed to export span batch due to timeout, max retries or shutdown.
proxy received: [b'CONNECT collector.invalid:443 HTTP/1.1', b'CONNECT collector.invalid:443 HTTP/1.1', b'CONNECT collector.invalid:443 HTTP/1.1', b'CONNECT collector.invalid:443 HTTP/1.1']
Actual Result
With 1.45.0 the proxy receives nothing, and the exporter resolves the endpoint itself:
Transient error HTTPSConnectionPool(host='collector.invalid', port=443): Max retries exceeded with url: /v1/traces (Caused by NameResolutionError("HTTPSConnection(host='collector.invalid', port=443): Failed to resolve 'collector.invalid' ([Errno -2] Name or service not known)")) encountered while exporting spans batch, retrying in 1.08s.
Failed to export spans batch due to timeout, max retries or shutdown.
proxy received: []
Additional context
- The logs and metrics exporters share
_build_transport, so I expect them to be affected too. I've only tested traces.
- The transport code on
main is unchanged since 1.45.0.
- I used an AI assistant to help trace the cause through the source. I ran the reproduction and checked the results myself.
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: Ubuntu 22.04 (Linux 6.8.0-138-generic, x86_64)
Python version: 3.12.12
SDK version: 1.45.0 (1.44.0 for the working run)
API version: 1.45.0 (1.44.0 for the working run)
uv: 0.9.13
What happened?
After upgrading from 1.44.0 to 1.45.0, the OTLP HTTP span exporter no longer uses the proxy set in
HTTPS_PROXY. It resolves and connects to the endpoint directly. In our environment the collector is only reachable through a proxy, so every export fails.This appears to come from #5389 ("switch default HTTP backend to urllib3"). The new default urllib3 transport doesn't read proxy environment variables, while the previous requests-based transport did. The 1.45.0 changelog doesn't mention this.
Steps to Reproduce
repro.py:The fake proxy only records the request line and closes the connection, so both runs end in a connection error. The difference is whether the exporter uses the proxy at all.
Expected Result
The exporter sends the request through the proxy, as 1.44.0 does:
Actual Result
With 1.45.0 the proxy receives nothing, and the exporter resolves the endpoint itself:
Additional context
_build_transport, so I expect them to be affected too. I've only tested traces.mainis unchanged since 1.45.0.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.