Skip to content

Commit 3b0ba66

Browse files
committed
requests: code review feedback
1 parent d0740a0 commit 3b0ba66

File tree

4 files changed

+4
-13
lines changed

4 files changed

+4
-13
lines changed

ddtrace/contrib/autopatch.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,3 @@ def patch_module(path):
4141
func()
4242
log.debug("patched")
4343
return True
44-
45-
if __name__ == '__main__':
46-
autopatch()

ddtrace/contrib/requests/__init__.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
2-
31
"""
4-
To trace HTTP calls from the request's library with or without monkeypatching.
5-
To automatically trace all requests, do the following:
6-
2+
To trace all HTTP calls from the requests library, patch the library like so::
73
84
# Patch the requests library.
95
from ddtrace.contrib.requests import patch
@@ -12,9 +8,8 @@
128
import requests
139
requests.get("http://www.datadog.com")
1410
15-
If you would prefer finer grained control, use a TracedSession object
16-
as you would a requests.Session:
17-
11+
If you would prefer finer grained control without monkeypatching the requests'
12+
code, use a TracedSession object as you would a requests.Session::
1813
1914
from ddtrace.contrib.requests import TracedSession
2015

ddtrace/contrib/requests/patch.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ def _traced_request_func(func, instance, args, kwargs):
3434
if not tracer.enabled:
3535
return func(*args, **kwargs)
3636

37-
# FIXME[matt] be a bit less brittle here.
3837
method = kwargs.get('method') or args[0]
3938
url = kwargs.get('url') or args[1]
4039

tests/contrib/requests/test_requests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def test_non_existant_url():
106106
tracer, session = get_traced_session()
107107

108108
try:
109-
session.get('http://i.hope.this.will.never.ever.exist.purple.monkey.dishwasher')
109+
session.get('http://doesnotexist.google.com')
110110
except Exception:
111111
pass
112112
else:

0 commit comments

Comments
 (0)