Add profiling support to Zaqar client
To be able to create profiling traces for Zaqar, client should be able to send special HTTP header that contains trace info. This patch is as well important to be able to make cross project traces. (Typical case end user calls Zaqar via OpenStack python client, if profiler is initialized, Zaqar client will add extra header, that will be parsed by special osprofiler middleware at server side) Don't worry no security issue here, trace information is signed by HMAC key that is setted in config file at server side. So only person that knows HMAC key is able to send proper header. Zaqar server patch is: I32565de6c447cd5e95a0ef54a9fbd4e571c2d820 Currently there are some projects are using osprofiler, like Glance, Cinder, Heat, and some others are working in progress, e.g. Trove. Implements: blueprint osprofiler Change-Id: I880c003511e9e4ef99806ba5b19d0ef6996be80b Co-Authored-By: wangxiyuan <wangxiyuan@huawei.com>
This commit is contained in:
parent
89ad44d746
commit
f7b2be6d08
@ -16,10 +16,14 @@
|
||||
from distutils import version
|
||||
import json
|
||||
|
||||
from oslo_utils import importutils
|
||||
|
||||
from zaqarclient.common import http
|
||||
from zaqarclient.transport import base
|
||||
from zaqarclient.transport import response
|
||||
|
||||
osprofiler_web = importutils.try_import("osprofiler.web")
|
||||
|
||||
|
||||
class HttpTransport(base.Transport):
|
||||
|
||||
@ -82,6 +86,9 @@ class HttpTransport(base.Transport):
|
||||
else:
|
||||
headers['content-type'] = 'application/json'
|
||||
|
||||
if osprofiler_web:
|
||||
headers.update(osprofiler_web.get_trace_id_headers())
|
||||
|
||||
resp = self.client.request(method,
|
||||
url=url,
|
||||
params=request.params,
|
||||
|
Loading…
x
Reference in New Issue
Block a user