Add OpenTracing based driver id

Drivers/tracers that follow OpenTracing API are using 64-bit id
instead of 128-bit id like native OSProfiler (uuid4 from uuidutils)

This output is for some tracers like Zipkin, Jaeger.

Depends-On: I8f75af487f50d5e67a1321a4c951d2a0d85733a1
Change-Id: Id4cf07a46e380af9a1aa30352193ca52624fc9eb
This commit is contained in:
Tovin Seven 2018-05-07 09:21:59 +07:00
parent f5166dcff7
commit 9071962d96
1 changed files with 7 additions and 2 deletions

View File

@ -153,14 +153,19 @@ class OpenStackShell(app.App):
def close_profile(self):
if self.do_profile:
trace_id = osprofiler_profiler.get().get_base_id()
profiler = osprofiler_profiler.get()
trace_id = profiler.get_base_id()
# Short ID for OpenTracing-based driver (64-bit id)
short_id = profiler.get_shorten_id(trace_id)
# NOTE(dbelova): let's use warning log level to see these messages
# printed. In fact we can define custom log level here with value
# bigger than most big default one (CRITICAL) or something like
# that (PROFILE = 60 for instance), but not sure we need it here.
self.log.warning("Trace ID: %s" % trace_id)
self.log.warning("Display trace with command:\n"
self.log.warning("Short trace ID "
"for OpenTracing-based drivers: %s" % short_id)
self.log.warning("Display trace data with command:\n"
"osprofiler trace show --html %s " % trace_id)
def run_subcommand(self, argv):