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

SDK-375: Add Qubole Trace_id support #285

Merged
merged 1 commit into from
Oct 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion qds_sdk/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import json
import pkg_resources
from requests.adapters import HTTPAdapter
from datetime import datetime
try:
from requests.packages.urllib3.poolmanager import PoolManager
except ImportError:
Expand Down Expand Up @@ -130,7 +131,13 @@ def _handle_error(response):

if 200 <= code < 400:
return


if 'X-Qubole-Trace-Id' in response.headers:
now = datetime.now()
time = now.strftime('%Y-%m-%d %H:%M:%S')
format_list = [time,response.headers['X-Qubole-Trace-Id']]
sys.stderr.write("[{}] Request ID is: {}. Please share it with Qubole Support team for any assistance".format(*format_list) + "\n")

if code == 400:
sys.stderr.write(response.text + "\n")
raise BadRequest(response)
Expand Down