diff options
author | Jenkins <jenkins@review.openstack.org> | 2014-07-08 20:53:00 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2014-07-08 20:53:00 +0000 |
commit | d613adc434e93c24d7c3bb34849d2aed1710e0d5 (patch) | |
tree | 02c8d2e76576c3d51ddb1bbab756cd3134481470 | |
parent | 797d101a64c8be10136ca8bc5541f2a06e0103ee (diff) | |
parent | e305dad557dc993073fac84d568e5e7689f56d04 (diff) | |
download | python-glanceclient-d613adc434e93c24d7c3bb34849d2aed1710e0d5.tar.gz |
Merge "Add profiling support to glanceclinet"
-rw-r--r-- | glanceclient/common/http.py | 7 |
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) |