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
This commit is contained in:
kpdev
2021-02-02 07:37:43 +01:00
committed by Kiran Pawar
parent 87e9b3333b
commit 52e9ef4a41
2 changed files with 7 additions and 0 deletions

View File

@@ -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

View File

@@ -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