Merge "Revert "Fix osprofiler support in horizon""
This commit is contained in:
commit
d27fcc0998
|
@ -112,7 +112,7 @@ def angular_templates(context):
|
||||||
result.extend(finder.find(relative_path, True))
|
result.extend(finder.find(relative_path, True))
|
||||||
path = result[-1]
|
path = result[-1]
|
||||||
try:
|
try:
|
||||||
with open(path, encoding='utf-8') as template_file:
|
with open(path) as template_file:
|
||||||
angular_templates[template_static_path] = template_file.read()
|
angular_templates[template_static_path] = template_file.read()
|
||||||
except (OSError, IOError):
|
except (OSError, IOError):
|
||||||
# Failed to read template, leave the template dictionary blank
|
# Failed to read template, leave the template dictionary blank
|
||||||
|
|
|
@ -22,7 +22,6 @@ from osprofiler.drivers.base import get_driver as profiler_get_driver
|
||||||
from osprofiler import notifier
|
from osprofiler import notifier
|
||||||
from osprofiler import profiler
|
from osprofiler import profiler
|
||||||
from osprofiler import web
|
from osprofiler import web
|
||||||
import six
|
|
||||||
from six.moves.urllib.parse import urlparse
|
from six.moves.urllib.parse import urlparse
|
||||||
|
|
||||||
|
|
||||||
|
@ -79,8 +78,9 @@ def _get_engine(request):
|
||||||
|
|
||||||
def list_traces(request):
|
def list_traces(request):
|
||||||
engine = _get_engine(request)
|
engine = _get_engine(request)
|
||||||
fields = ['base_id', 'timestamp', 'info.request.path', 'info']
|
query = {"info.user_id": request.user.id}
|
||||||
traces = engine.list_traces(fields)
|
fields = ['base_id', 'timestamp', 'info.request.path']
|
||||||
|
traces = engine.list_traces(query, fields)
|
||||||
return [{'id': trace['base_id'],
|
return [{'id': trace['base_id'],
|
||||||
'timestamp': trace['timestamp'],
|
'timestamp': trace['timestamp'],
|
||||||
'origin': trace['info']['request']['path']} for trace in traces]
|
'origin': trace['info']['request']['path']} for trace in traces]
|
||||||
|
@ -118,9 +118,6 @@ def update_trace_headers(keys, **kwargs):
|
||||||
trace_info.update(kwargs)
|
trace_info.update(kwargs)
|
||||||
p = profiler.get()
|
p = profiler.get()
|
||||||
trace_data = utils.signed_pack(trace_info, p.hmac_key)
|
trace_data = utils.signed_pack(trace_info, p.hmac_key)
|
||||||
if six.PY3:
|
|
||||||
trace_data = [key.decode() if isinstance(key, six.binary_type)
|
|
||||||
else key for key in trace_data]
|
|
||||||
return json.dumps({web.X_TRACE_INFO: trace_data[0],
|
return json.dumps({web.X_TRACE_INFO: trace_data[0],
|
||||||
web.X_TRACE_HMAC: trace_data[1]})
|
web.X_TRACE_HMAC: trace_data[1]})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue