issue in httplib and requests
See original GitHub issueThe following code would generate 5 spans, which seems to be confusing:
import requests
from opencensus.trace import config_integration
from opencensus.trace.tracer import Tracer
config_integration.trace_integrations(['httplib', 'requests'])
tracer = Tracer()
with tracer.span(name='parent'):
response = requests.get('https://www.wikipedia.org/wiki/Rabbit')
Expected:
- Probably we only want 4 spans, need to dig out more:
parent span
requests span
httplib span, which returned HTTP 301 (redirection)
httplib span, which returned HTTP 200
- The httplib span attribute
http.url
should be full URL, current it is/wiki/Rabbit
.
[SpanData(name='[httplib]request', context=SpanContext(trace_id=56b691b1c448a80bfd21455d1e3916ac, span_id=21a6c4871e00d227, trace_options=TraceOptions(enabled=True), tracestate=None), span_id='b0cd26aa762e72c5', parent_span_id='21a6c4871e00d227', attributes={'http.url': '/wiki/Rabbit', 'http.method': 'GET', 'http.status_code': '301'}, start_time='2019-04-23T00:46:40.566298Z', end_time='2019-04-23T00:46:40.587506Z', child_span_count=0, stack_trace=None, time_events=[], links=[], status=None, same_process_as_parent_span=None, span_kind=2)]
[SpanData(name='[httplib]request', context=SpanContext(trace_id=56b691b1c448a80bfd21455d1e3916ac, span_id=21a6c4871e00d227, trace_options=TraceOptions(enabled=True), tracestate=None), span_id='9099cb62a56c5910', parent_span_id='21a6c4871e00d227', attributes={'http.url': '/wiki/Rabbit', 'http.method': 'GET', 'http.status_code': '200'}, start_time='2019-04-23T00:46:40.703073Z', end_time='2019-04-23T00:46:40.718689Z', child_span_count=0, stack_trace=None, time_events=[], links=[], status=None, same_process_as_parent_span=None, span_kind=2)]
[SpanData(name='[requests]get', context=SpanContext(trace_id=56b691b1c448a80bfd21455d1e3916ac, span_id=f240885e8fcd8866, trace_options=TraceOptions(enabled=True), tracestate=None), span_id='21a6c4871e00d227', parent_span_id='f240885e8fcd8866', attributes={'http.url': 'https://www.wikipedia.org/wiki/Rabbit', 'http.status_code': '200'}, start_time='2019-04-23T00:46:40.433738Z', end_time='2019-04-23T00:46:40.770006Z', child_span_count=0, stack_trace=None, time_events=[], links=[], status=None, same_process_as_parent_span=None, span_kind=2)]
[SpanData(name='[requests]get', context=SpanContext(trace_id=56b691b1c448a80bfd21455d1e3916ac, span_id=f9b3b7a04c993de9, trace_options=TraceOptions(enabled=True), tracestate=None), span_id='f240885e8fcd8866', parent_span_id='f9b3b7a04c993de9', attributes={'http.url': 'https://www.wikipedia.org/wiki/Rabbit', 'http.status_code': '200'}, start_time='2019-04-23T00:46:40.433738Z', end_time='2019-04-23T00:46:40.776972Z', child_span_count=0, stack_trace=None, time_events=[], links=[], status=None, same_process_as_parent_span=None, span_kind=2)]
[SpanData(name='parent', context=SpanContext(trace_id=56b691b1c448a80bfd21455d1e3916ac, span_id=None, trace_options=TraceOptions(enabled=True), tracestate=None), span_id='f9b3b7a04c993de9', parent_span_id=None, attributes={}, start_time='2019-04-23T00:46:40.433738Z', end_time='2019-04-23T00:46:40.778972Z', child_span_count=0, stack_trace=None, time_events=[], links=[], status=None, same_process_as_parent_span=None, span_kind=0)]
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (9 by maintainers)
Top Results From Across the Web
Python: Issues with httplib & requests; https seems to cause a ...
I'm currently trying to use BeautifulSoup to scrape some information from the discogs website which isn't available through their API.
Read more >Python Module Httplib GET request issue - Orion SDK
In a nutshell, I'm attempting to query my organizations SolarWinds DB using this library but I'm running into some issues with my GET...
Read more >http.client — HTTP protocol client — Python 3.11.1 ...
This module defines classes that implement the client side of the HTTP and HTTPS protocols. It is normally not used directly — the...
Read more >Get & Post HTTP & JSON Requests - Learn Python - DataCamp
There are many libraries to make an HTTP request in Python, which are httplib, urllib, httplib2 , treq, etc., but requests are the...
Read more >Python's urllib.request for HTTP Requests - Real Python
To understand some of the issues that you may encounter when using urllib.request , you'll need to examine how a response is represented...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@lzchen FYI.
@victoraugustolls Thanks for bringing it up. We haven’t worked on this issue.
Here goes my current thinking:
HTTP GET http://non.existing.domain/
, we expect the logical operation to fail, with no actual physical HTTP call (since DNS resolution failure will trigger exception on the HTTP client).We can discuss more at https://github.com/open-telemetry/opentelemetry-specification/issues/110.
With this, I would expect the result to be:
@NoutieH If you would like to contribute this part, go for it! I can assign the task to you.