summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkpdev <kinpaa@gmail.com>2021-02-02 07:37:43 +0100
committerKiran Pawar <kinpaa@gmail.com>2021-12-24 17:53:46 +0000
commit52e9ef4a4112ac5d4108b10c43472b384425a187 (patch)
treeccaf5ad1fc1d517d30225fbb87fd157ebdd38efd
parent87e9b3333bb7d1b2648474df6bbb6a06693964fd (diff)
downloadpython-designateclient-52e9ef4a4112ac5d4108b10c43472b384425a187.tar.gz
Add profiling support to designateclient
To be able to create profiling traces for Designate, client should be able to send special HTTP header that contains trace info. Don't worry no security issue here, trace information is signed by HMAC key that is setted in api-paste.ini. So only person that knows HMAC key is able to send proper header. Main patch (in Designate) is: https://review.opendev.org/c/openstack/designate/+/773574 Change-Id: I4b84ac1a5d4f84da3a38e4e0cb0990a54c6044ef
-rw-r--r--designateclient/v2/client.py6
-rw-r--r--lower-constraints.txt1
2 files changed, 7 insertions, 0 deletions
diff --git a/designateclient/v2/client.py b/designateclient/v2/client.py
index b9a42af..0508535 100644
--- a/designateclient/v2/client.py
+++ b/designateclient/v2/client.py
@@ -31,6 +31,9 @@ from designateclient.v2.zones import ZoneExportsController
from designateclient.v2.zones import ZoneImportsController
from designateclient.v2.zones import ZoneTransfersController
from designateclient import version
+from oslo_utils import importutils
+
+osprofiler_web = importutils.try_import("osprofiler.web")
class DesignateAdapter(adapter.LegacyJsonAdapter):
@@ -78,6 +81,9 @@ class DesignateAdapter(adapter.LegacyJsonAdapter):
kwargs['headers'].setdefault(
'Content-Type', 'application/json')
+ if osprofiler_web:
+ kwargs['headers'].update(osprofiler_web.get_trace_id_headers())
+
response, body = super(self.__class__, self).request(*args, **kwargs)
# Decode is response, if possible
diff --git a/lower-constraints.txt b/lower-constraints.txt
index 91454f7..b569a28 100644
--- a/lower-constraints.txt
+++ b/lower-constraints.txt
@@ -41,6 +41,7 @@ oslo.log==3.36.0
oslo.serialization==2.18.0
oslo.utils==3.33.0
oslotest==3.2.0
+osprofiler==3.4.0
paramiko==2.0.0
pbr==2.0.0
prettytable==0.7.2