Merge "Add support for collect-timing option"
This commit is contained in:
commit
4655a23987
@ -705,6 +705,12 @@ class OpenStackCinderShell(object):
|
||||
if not auth_session:
|
||||
auth_session = self._get_keystone_session()
|
||||
|
||||
# collect_timing is a keystone session option
|
||||
if (not isinstance(auth_session, session.Session)
|
||||
and getattr(args, 'collect_timing', False) is True):
|
||||
raise exc.AuthorizationFailure("Provided auth plugin doesn't "
|
||||
"support collect_timing option")
|
||||
|
||||
insecure = self.options.insecure
|
||||
|
||||
client_args = dict(
|
||||
@ -805,6 +811,17 @@ class OpenStackCinderShell(object):
|
||||
print("To display trace use next command:\n"
|
||||
"osprofiler trace show --html %s " % trace_id)
|
||||
|
||||
if getattr(args, 'collect_timing', False) is True:
|
||||
self._print_timings(auth_session)
|
||||
|
||||
def _print_timings(self, session):
|
||||
timings = session.get_timings()
|
||||
utils.print_list(
|
||||
timings,
|
||||
fields=('method', 'url', 'seconds'),
|
||||
sortby_index=None,
|
||||
formatters={'seconds': lambda r: r.elapsed.total_seconds()})
|
||||
|
||||
def _discover_client(self,
|
||||
current_client,
|
||||
os_api_version,
|
||||
|
6
releasenotes/notes/collect-timing-ce6d521d40d422fb.yaml
Normal file
6
releasenotes/notes/collect-timing-ce6d521d40d422fb.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
`Bug #1960337 <https://bugs.launchpad.net/cinder/+bug/1960337>`_: Added
|
||||
support for ``collect-timing`` parameter to see the timings of REST API
|
||||
requests from the client when using Keystone authentication.
|
Loading…
Reference in New Issue
Block a user