summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2014-07-08 20:53:00 +0000
committerGerrit Code Review <review@openstack.org>2014-07-08 20:53:00 +0000
commitd613adc434e93c24d7c3bb34849d2aed1710e0d5 (patch)
tree02c8d2e76576c3d51ddb1bbab756cd3134481470
parent797d101a64c8be10136ca8bc5541f2a06e0103ee (diff)
parente305dad557dc993073fac84d568e5e7689f56d04 (diff)
downloadpython-glanceclient-d613adc434e93c24d7c3bb34849d2aed1710e0d5.tar.gz
Merge "Add profiling support to glanceclinet"
-rw-r--r--glanceclient/common/http.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/glanceclient/common/http.py b/glanceclient/common/http.py
index b950c28..84714df 100644
--- a/glanceclient/common/http.py
+++ b/glanceclient/common/http.py
@@ -40,9 +40,12 @@ import OpenSSL
from glanceclient.common import utils
from glanceclient import exc
+from glanceclient.openstack.common import importutils
from glanceclient.openstack.common import network_utils
from glanceclient.openstack.common import strutils
+osprofiler_web = importutils.try_import("osprofiler.web")
+
try:
from eventlet import patcher
# Handle case where we are running in a monkey patched environment
@@ -189,6 +192,10 @@ class HTTPClient(object):
# Copy the kwargs so we can reuse the original in case of redirects
kwargs['headers'] = copy.deepcopy(kwargs.get('headers', {}))
kwargs['headers'].setdefault('User-Agent', USER_AGENT)
+
+ if osprofiler_web:
+ kwargs['headers'].update(osprofiler_web.get_trace_id_headers())
+
if self.auth_token:
kwargs['headers'].setdefault('X-Auth-Token', self.auth_token)