Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility introduced in HTTPX 0.23.1 #4593

Closed
burritoatspoton opened this issue Nov 18, 2022 · 0 comments · Fixed by #4595
Closed

Incompatibility introduced in HTTPX 0.23.1 #4593

burritoatspoton opened this issue Nov 18, 2022 · 0 comments · Fixed by #4595

Comments

@burritoatspoton
Copy link

Summary of problem

HTTPX 0.23.1 introduced a breaking change (https://github.com/encode/httpx/pull/2241/files#diff-f1eb4e8fbdbce3bb7dcc3ecb662f690f9443599de8b172513ddb65de6b1d7c73L325-L339) by removing a property that ddtrace relies on (https://github.com/DataDog/dd-trace-py/blob/1.x/ddtrace/contrib/httpx/patch.py#L42).

Which version of dd-trace-py are you using?

1.6.1

Which version of pip are you using?

22.3.1

Which libraries and their versions are you using?

`pip freeze` anyio==3.6.2 attrs==22.1.0 bytecode==0.13.0 cattrs==22.2.0 certifi==2022.9.24 ddsketch==2.0.4 ddtrace==1.6.1 envier==0.4.0 exceptiongroup==1.0.4 h11==0.14.0 httpcore==0.16.1 httpx==0.23.1 idna==3.4 jsonschema==4.17.0 packaging==21.3 protobuf==4.21.9 pyparsing==3.0.9 pyrsistent==0.19.2 rfc3986==1.5.0 six==1.16.0 sniffio==1.3.0 tenacity==8.1.0 typing_extensions==4.4.0 xmltodict==0.13.0

How can we reproduce your problem?

main.py

import httpx
httpx.get("https://google.com")

and then

$ ddtrace-run python main.py

What is the result that you get?

Traceback (most recent call last):
  File "/Users/burrito/tmp/main.py", line 3, in <module>
    httpx.get("https://google.com")
  File "/Users/burrito/tmp/env/lib/python3.10/site-packages/httpx/_api.py", line 189, in get
    return request(
  File "/Users/burrito/tmp/env/lib/python3.10/site-packages/httpx/_api.py", line 100, in request
    return client.request(
  File "/Users/burrito/tmp/env/lib/python3.10/site-packages/httpx/_client.py", line 821, in request
    return self.send(request, auth=auth, follow_redirects=follow_redirects)
  File "/Users/burrito/tmp/env/lib/python3.10/site-packages/ddtrace/contrib/httpx/patch.py", line 132, in _wrapped_sync_send
    _set_span_meta(span, req, resp)
  File "/Users/burrito/tmp/env/lib/python3.10/site-packages/ddtrace/contrib/httpx/patch.py", line 81, in _set_span_meta
    url=_url_to_str(request.url),
  File "/Users/burrito/tmp/env/lib/python3.10/site-packages/ddtrace/contrib/httpx/patch.py", line 42, in _url_to_str
    scheme, host, port, raw_path = url.raw
AttributeError: 'URL' object has no attribute 'raw'

What is the result that you expected?

Request performed and traces being sent correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants