Contributors mailing list archives

Browse archives


Tracing and in general how can we execute an handler on every request

SAS Clouder, Yannick Buron
- 08/12/2021 12:20:04

Hello all,

I have a technical question and I wonder if anyone here already faced this issue.

I am trying to integrate Odoo into our monitoring stack, with the three pillars of observability metrics/logging/tracing, starting with the tracing. My issue is, it doesn't look like we have an easy way to insert the handler which will start the trace. Also no documentation anywhere about how we can easily integrate tracing into Odoo. This is a v12 version but I believe the issue is still here on more recent versions.

We are planning to use Azure Monitor, but the issue will be the same with any other tracing platform : I can't figure a way to override a core function to start the trace and insert the python library I need

I can of course override some of the most important controllers like


from odoo.addons.web.controllers.main import DataSet
class ExtendDataSet(DataSet):
def call_kw(self, model, method, args, kwargs, path=None):
print("Insert tracer here")
return super(
ExtendDataSet, self).call_kw(
model, method, args, kwargs, path=path)


But this will force me to override all controllers I can find, and some custom controllers will obviously go under the radar.

I identified some entry point used by all requests like or but I don't think I have a way to override theses functions without having to rely on the terrible idea to patch the core code.

Anything I missed on how we could execute some code on every request ? On Django you would just use a middleware for such purpose and it does the job perfectly, I feel like this is something which is really missing in Odoo when we have such requirements.