From 2e2ef6a8d045c150116242a5b0bed635483fc7c8 Mon Sep 17 00:00:00 2001 From: Stuart Grace Date: Fri, 15 Jun 2018 17:56:25 +0100 Subject: [PATCH] Delete profiler object when request completes When a request that is being profiled completes and the response is received, the middleware expires the profiling cookie. It also needs to delete the profiling object that holds the base_id UUID so a new base_id will be created for the next profile. Otherwise the same base_id is used for subsequent queries and they become merged togther in the database. Change-Id: I379cebfa2ed5282c96df0e255a8ba04c65a8523c Closes-Bug: #1777486 Depends-On: https://review.openstack.org/578362 --- lower-constraints.txt | 2 +- openstack_dashboard/contrib/developer/profiler/middleware.py | 3 +++ requirements.txt | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lower-constraints.txt b/lower-constraints.txt index 44d59ca031..76fce7c973 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -71,7 +71,7 @@ oslo.policy==1.30.0 oslo.serialization==2.18.0 oslo.service==1.24.0 oslo.utils==3.33.0 -osprofiler==1.4.0 +osprofiler==2.3.0 Paste==2.0.2 PasteDeploy==1.5.0 pbr==2.0.0 diff --git a/openstack_dashboard/contrib/developer/profiler/middleware.py b/openstack_dashboard/contrib/developer/profiler/middleware.py index ef9a03d7c2..fa3befb145 100644 --- a/openstack_dashboard/contrib/developer/profiler/middleware.py +++ b/openstack_dashboard/contrib/developer/profiler/middleware.py @@ -141,5 +141,8 @@ class ProfilerMiddleware(object): response.set_cookie('profile_page', max_age=0, path=path) def process_response(self, request, response): + if profiler.get() is not None: + profiler.clean() + self.clear_profiling_cookies(request, response) return response diff --git a/requirements.txt b/requirements.txt index c80b776b0a..c8f93f9421 100644 --- a/requirements.txt +++ b/requirements.txt @@ -25,7 +25,7 @@ oslo.i18n>=3.15.3 # Apache-2.0 oslo.policy>=1.30.0 # Apache-2.0 oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0 oslo.utils>=3.33.0 # Apache-2.0 -osprofiler>=1.4.0 # Apache-2.0 +osprofiler>=2.3.0 # Apache-2.0 Pint>=0.5 # BSD pymongo!=3.1,>=3.0.2 # Apache-2.0 pyScss!=1.3.5,>=1.3.4 # MIT License