Module
Sentry
Describe the Bug
In Odoo 18, after installing the Sentry module, no new Sentry scope is automatically created for each HTTP request, resulting in missing traces for debugging.
To Reproduce
Affected versions: Odoo 18 Enterprise, Sentry module 18.0.1.0.3
Steps to reproduce the behavior:
- Install Odoo 18 and the Sentry module.
- Configure Sentry in the
server_wide_modules with web,sentry.
- Add debug logs in
hooks.py to track server app and HTTP application patching:
# The server app is already registered so patch it here
if server:
app_type = server.app.__class__.__name__
_logger.info(f"Server app type: {app_type}")
server.app = SentryWsgiMiddleware(server.app)
_logger.info(f"Server app type after patching: {server.app.__class__.__name__}")
else:
_logger.info("Server app not found")
# Patch the wsgi server in case of further registration
_logger.info(f"Odoo http application type: {odoo.http.Application.__class__.__name__}")
odoo.http.Application = SentryWsgiMiddleware(odoo.http.Application)
_logger.info(f"Odoo http application type: {odoo.http.Application.__class__.__name__}")
- Start the Odoo server and observe logs:
2025-09-18 06:49:27,009 32 INFO ? odoo.addons.sentry.hooks: Initializing sentry...
2025-09-18 06:49:27,020 32 INFO ? odoo.addons.sentry.hooks: Server app not found
2025-09-18 06:49:27,051 32 INFO ? odoo.addons.sentry.hooks: Odoo http application type: type
2025-09-18 06:49:27,052 32 INFO ? odoo.addons.sentry.hooks: Odoo http application type: SentryWsgiMiddleware
Expected Behavior
A new Sentry scope should be automatically created for each HTTP request, and the server.app = SentryWsgiMiddleware(server.app) line in hooks.py should execute to patch the server app, ensuring proper Sentry integration.
Additional Context
- The
server.app = SentryWsgiMiddleware(server.app) line is not executed, as indicated by the log "Server app not found."
- Operating System: Ubuntu Noble
- Python Version: 3.12
- Sentry is loaded as a server-wide module alongside
web.
- Sentry SDK: Tested with sentry-sdk==2.22.0 and sentry-sdk==2.37.0. Both having the same problem
- Tried workers = 0 and Workers = 4. Both is having the same problem
Module
Sentry
Describe the Bug
In Odoo 18, after installing the Sentry module, no new Sentry scope is automatically created for each HTTP request, resulting in missing traces for debugging.
To Reproduce
Affected versions: Odoo 18 Enterprise, Sentry module 18.0.1.0.3
Steps to reproduce the behavior:
server_wide_moduleswithweb,sentry.hooks.pyto track server app and HTTP application patching:Expected Behavior
A new Sentry scope should be automatically created for each HTTP request, and the
server.app = SentryWsgiMiddleware(server.app)line inhooks.pyshould execute to patch the server app, ensuring proper Sentry integration.Additional Context
server.app = SentryWsgiMiddleware(server.app)line is not executed, as indicated by the log "Server app not found."web.