Merge "Add profiling support to glanceclinet"
This commit is contained in:
@@ -40,9 +40,12 @@ import OpenSSL
|
|||||||
|
|
||||||
from glanceclient.common import utils
|
from glanceclient.common import utils
|
||||||
from glanceclient import exc
|
from glanceclient import exc
|
||||||
|
from glanceclient.openstack.common import importutils
|
||||||
from glanceclient.openstack.common import network_utils
|
from glanceclient.openstack.common import network_utils
|
||||||
from glanceclient.openstack.common import strutils
|
from glanceclient.openstack.common import strutils
|
||||||
|
|
||||||
|
osprofiler_web = importutils.try_import("osprofiler.web")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from eventlet import patcher
|
from eventlet import patcher
|
||||||
# Handle case where we are running in a monkey patched environment
|
# 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
|
# Copy the kwargs so we can reuse the original in case of redirects
|
||||||
kwargs['headers'] = copy.deepcopy(kwargs.get('headers', {}))
|
kwargs['headers'] = copy.deepcopy(kwargs.get('headers', {}))
|
||||||
kwargs['headers'].setdefault('User-Agent', USER_AGENT)
|
kwargs['headers'].setdefault('User-Agent', USER_AGENT)
|
||||||
|
|
||||||
|
if osprofiler_web:
|
||||||
|
kwargs['headers'].update(osprofiler_web.get_trace_id_headers())
|
||||||
|
|
||||||
if self.auth_token:
|
if self.auth_token:
|
||||||
kwargs['headers'].setdefault('X-Auth-Token', self.auth_token)
|
kwargs['headers'].setdefault('X-Auth-Token', self.auth_token)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user