Skip to content

Commit 6155045

Browse files
committed
requests: set span type
1 parent 3b0ba66 commit 6155045

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

ddtrace/contrib/requests/patch.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1+
"""
2+
Tracing for the requests library.
13
4+
https://github.com/kennethreitz/requests
5+
"""
26

37
# stdlib
48
import logging
@@ -37,13 +41,12 @@ def _traced_request_func(func, instance, args, kwargs):
3741
method = kwargs.get('method') or args[0]
3842
url = kwargs.get('url') or args[1]
3943

40-
with tracer.trace("requests.request") as span:
44+
with tracer.trace("requests.request", span_type=http.TYPE) as span:
4145
resp = None
4246
try:
4347
resp = func(*args, **kwargs)
4448
return resp
4549
finally:
46-
4750
try:
4851
_apply_tags(span, method, url, resp)
4952
except Exception:

tests/contrib/requests/test_requests.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ def test_200():
8787
eq_(s.get_tag(http.STATUS_CODE), '200')
8888
eq_(s.error, 0)
8989
eq_(s.service, 'httpstat.us')
90+
eq_(s.span_type, http.TYPE)
9091

9192
@staticmethod
9293
def test_post_500():

0 commit comments

Comments
 (0)