README.rst 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
  2. :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
  3. :alt: License: AGPL-3
  4. ======
  5. Sentry
  6. ======
  7. This module allows painless `Sentry <https://sentry.io/>`__ integration with
  8. Odoo.
  9. Installation
  10. ============
  11. The module can be installed just like any other Odoo module, by adding the
  12. module's directory to Odoo *addons_path*. In order for the module to correctly
  13. wrap the Odoo WSGI application, it also needs to be loaded as a server-wide
  14. module. This can be done with the ``server_wide_modules`` parameter in your
  15. Odoo config file or with the ``--load`` command-line parameter.
  16. This module additionally requires the raven_ Python package to be available on
  17. the system. It can be installed using pip::
  18. pip install raven
  19. Configuration
  20. =============
  21. The following additional configuration options can be added to your Odoo
  22. configuration file:
  23. ============================= ==================================================================== ==========================================================
  24. Option Description Default
  25. ============================= ==================================================================== ==========================================================
  26. ``sentry_dsn`` Sentry *Data Source Name*. You can find this value in your Sentry ``''``
  27. project configuration. Typically it looks something like this:
  28. *https://<public_key>:<secret_key>@sentry.example.com/<project id>*
  29. This is the only required option in order to use the module.
  30. ``sentry_enabled`` Whether or not Sentry logging is enabled. ``False``
  31. ``sentry_logging_level`` The minimal logging level for which to send reports to Sentry. ``warn``
  32. Possible values: *notset*, *debug*, *info*, *warn*, *error*,
  33. *critical*. It is recommended to have this set to at least *warn*,
  34. to avoid spamming yourself with Sentry events.
  35. ``sentry_exclude_loggers`` A string of comma-separated logger names which should be excluded ``werkzeug``
  36. from Sentry.
  37. ``sentry_ignored_exceptions`` A string of comma-separated exceptions which should be ignored. ``odoo.exceptions.AccessDenied,
  38. You can use a star symbol (*) at the end, to ignore all exceptions odoo.exceptions.AccessError,
  39. from a module, eg.: *odoo.exceptions.**. odoo.exceptions.DeferredException,
  40. odoo.exceptions.MissingError,
  41. odoo.exceptions.RedirectWarning,
  42. odoo.exceptions.UserError,
  43. odoo.exceptions.ValidationError,
  44. odoo.exceptions.Warning,
  45. odoo.exceptions.except_orm``
  46. ``sentry_processors`` A string of comma-separated processor classes which will be applied ``raven.processors.SanitizePasswordsProcessor,
  47. on an event before sending it to Sentry. odoo.addons.sentry.logutils.SanitizeOdooCookiesProcessor``
  48. ``sentry_transport`` Transport class which will be used to send events to Sentry. ``threaded``
  49. Possible values: *threaded*: spawns an async worker for processing
  50. messages, *synchronous*: a synchronous blocking transport;
  51. *requests_threaded*: an asynchronous transport using the *requests*
  52. library; *requests_synchronous* - blocking transport using the
  53. *requests* library.
  54. ``sentry_include_context`` If enabled, additional context data will be extracted from current ``True``
  55. HTTP request and user session (if available). This has no effect
  56. for Cron jobs, as no request/session is available inside a Cron job.
  57. ``sentry_odoo_dir`` Absolute path to your Odoo installation directory. This is optional
  58. and will only be used to extract the Odoo Git commit, which will be
  59. sent to Sentry, to allow to distinguish between Odoo updates.
  60. ============================= ==================================================================== ==========================================================
  61. Other `client arguments
  62. <https://docs.sentry.io/clients/python/advanced/#client-arguments>`_ can be
  63. configured by prepending the argument name with *sentry_* in your Odoo config
  64. file. Currently supported additional client arguments are: ``install_sys_hook,
  65. include_paths, exclude_paths, machine, auto_log_stacks, capture_locals,
  66. string_max_length, list_max_length, site, include_versions, environment``.
  67. Installation
  68. ------------
  69. Reference: https://github.com/getsentry/onpremise
  70. Example Odoo configuration
  71. --------------------------
  72. Below is an example of Odoo configuration file with *Odoo Sentry* options::
  73. [options]
  74. server_wide_modules=web,web_kanban,sentry
  75. sentry_dsn = https://<public_key>:<secret_key>@sentry.example.com/<project id>
  76. sentry_enabled = true
  77. sentry_logging_level = warn
  78. sentry_exclude_loggers = werkzeug
  79. sentry_ignore_exceptions = odoo.exceptions.AccessDenied,odoo.exceptions.AccessError,odoo.exceptions.MissingError,odoo.exceptions.RedirectWarning,odoo.exceptions.UserError,odoo.exceptions.ValidationError,odoo.exceptions.Warning,odoo.exceptions.except_orm
  80. sentry_processors = raven.processors.SanitizePasswordsProcessor,odoo.addons.sentry.logutils.SanitizeOdooCookiesProcessor
  81. sentry_transport = threaded
  82. sentry_include_context = true
  83. sentry_environment = production
  84. sentry_auto_log_stacks = false
  85. sentry_odoo_dir = /home/odoo/odoo/
  86. Usage
  87. =====
  88. Once configured and installed, the module will report any logging event at and
  89. above the configured Sentry logging level, no additional actions are necessary.
  90. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
  91. :alt: Try me on Runbot
  92. :target: https://runbot.odoo-community.org/runbot/149/10.0
  93. Known issues / Roadmap
  94. ======================
  95. * **No database separation** -- This module functions by intercepting all Odoo
  96. logging records in a running Odoo process. This means that once installed in
  97. one database, it will intercept and report errors for all Odoo databases,
  98. which are used on that Odoo server.
  99. * **Frontend integration** -- In the future, it would be nice to add
  100. Odoo client-side error reporting to this module as well, by integrating
  101. `raven-js <https://github.com/getsentry/raven-js>`_. Additionally, `Sentry user
  102. feedback form <https://docs.sentry.io/learn/user-feedback/>`_ could be
  103. integrated into the Odoo client error dialog window to allow users shortly
  104. describe what they were doing when things went wrong.
  105. Bug Tracker
  106. ===========
  107. Bugs are tracked on `GitHub Issues
  108. <https://github.com/OCA/server-tools/issues>`_. In case of trouble, please
  109. check there if your issue has already been reported. If you spotted it first,
  110. help us smash it by providing detailed and welcomed feedback.
  111. Credits
  112. =======
  113. Images
  114. ------
  115. * `Module Icon <https://sentry.io/branding/>`_
  116. Contributors
  117. ------------
  118. * Mohammed Barsi <barsintod@gmail.com>
  119. * Andrius Preimantas <andrius@versada.eu>
  120. * Naglis Jonaitis <naglis@versada.eu>
  121. Maintainer
  122. ----------
  123. .. image:: https://odoo-community.org/logo.png
  124. :alt: Odoo Community Association
  125. :target: https://odoo-community.org
  126. This module is maintained by the OCA.
  127. OCA, or the Odoo Community Association, is a nonprofit organization whose
  128. mission is to support the collaborative development of Odoo features and
  129. promote its widespread use.
  130. To contribute to this module, please visit https://odoo-community.org.
  131. .. _raven: https://github.com/getsentry/raven-python