Browse Source

[REF] profiler: Patching rpccalls

pull/1465/head
Enric Tobella 6 years ago
parent
commit
4b65bbc1c8
  1. 18
      profiler/hooks.py
  2. 1
      profiler/views/profiler_profile_view.xml

18
profiler/hooks.py

@ -1,8 +1,9 @@
import logging
from openerp.http import WebRequest
from openerp.sql_db import Cursor
from odoo.http import WebRequest
from odoo import http
from odoo.sql_db import Cursor
from .models.profiler_profile import ProfilerProfile
@ -40,6 +41,19 @@ def patch_cursor_init():
Cursor.__init__ = init_f
def patch_dispatch_rpc():
_logger.info('Patching Dispatch RPC http.dispatch_rpc')
dispatch_rpc = http.dispatch_rpc
def dispatch_rpc_f(service_name, method, params):
with ProfilerProfile.profiling():
return dispatch_rpc(service_name, method, params)
http.dispatch_rpc = dispatch_rpc_f
def post_load():
patch_web_request_call_function()
patch_cursor_init()
patch_dispatch_rpc()

1
profiler/views/profiler_profile_view.xml

@ -36,6 +36,7 @@
<field name="arch" type="xml">
<search string="Search Profiling lines">
<field name="profile_id"/>
<field name="cprof_fname"/>
</search>
</field>
</record>

Loading…
Cancel
Save