fix: Move Monitor dump to after_response (#26703)

It needs access to response to capture status code and size etc
This commit is contained in:
Ankush Menat 2024-06-06 20:08:22 +05:30 committed by GitHub
parent 48e59248e6
commit 04642edd63
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 5 additions and 2 deletions

View file

@ -79,7 +79,6 @@ def after_response_wrapper(app):
app(environ, start_response), app(environ, start_response),
( (
frappe.rate_limiter.update, frappe.rate_limiter.update,
frappe.monitor.stop,
frappe.recorder.dump, frappe.recorder.dump,
frappe.request.after_response.run, frappe.request.after_response.run,
frappe.destroy, frappe.destroy,

View file

@ -423,6 +423,10 @@ before_request = [
"frappe.rate_limiter.apply", "frappe.rate_limiter.apply",
] ]
after_request = [
"frappe.monitor.stop",
]
# Background Job Hooks # Background Job Hooks
before_job = [ before_job = [
"frappe.recorder.record", "frappe.recorder.record",

View file

@ -217,7 +217,7 @@ class TestOverheadCalls(FrappeAPITestCase):
def test_ping_overheads(self): def test_ping_overheads(self):
self.get(self.method("ping"), {"sid": "Guest"}) self.get(self.method("ping"), {"sid": "Guest"})
with self.assertRedisCallCounts(12), self.assertQueryCount(self.BASE_SQL_CALLS): with self.assertRedisCallCounts(13), self.assertQueryCount(self.BASE_SQL_CALLS):
self.get(self.method("ping"), {"sid": "Guest"}) self.get(self.method("ping"), {"sid": "Guest"})
def test_list_view_overheads(self): def test_list_view_overheads(self):