Fix session timing

Subclass keystoneclient.session.Session to add the timing hooks to
record the elapsed time returned by requests.Response objects, including
the redirection history.  Redirects are included individually and not
rolled into the total time for the original request.

This works for all clients that use OSC's session.

Closes-Bug: #1402577
Change-Id: I9360c90c151579b89a37edb8c11c17feb15b3cb9
This commit is contained in:
Dean Troyer
2014-09-05 02:00:36 -05:00
committed by lin-hua-cheng
parent a9d1e3d219
commit 0d689871b4
5 changed files with 71 additions and 19 deletions

@@ -316,11 +316,10 @@ class OpenStackShell(app.App):
# Process collected timing data
if self.options.timing:
# Loop through extensions
for mod in self.ext_modules:
client = getattr(self.client_manager, mod.API_NAME)
if hasattr(client, 'get_timings'):
self.timing_data.extend(client.get_timings())
# Get session data
self.timing_data.extend(
self.client_manager.session.get_timings(),
)
# Use the Timing pseudo-command to generate the output
tcmd = timing.Timing(self, self.options)