Skip to content

Commit

Permalink
[MIG] sentry: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
atchuthan committed Dec 31, 2024
1 parent a721027 commit c399919
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 37 deletions.
49 changes: 25 additions & 24 deletions sentry/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Sentry
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github
:target: https://github.com/OCA/server-tools/tree/17.0/sentry
:target: https://github.com/OCA/server-tools/tree/18.0/sentry
:alt: OCA/server-tools
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/server-tools-17-0/server-tools-17-0-sentry
:target: https://translation.odoo-community.org/projects/server-tools-18-0/server-tools-18-0-sentry
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=17.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -106,25 +106,25 @@ are necessary.
Known issues / Roadmap
======================

- **No database separation** -- This module functions by intercepting
all Odoo logging records in a running Odoo process. This means that
once installed in one database, it will intercept and report errors
for all Odoo databases, which are used on that Odoo server.
- **Frontend integration** -- In the future, it would be nice to add
Odoo client-side error reporting to this module as well, by
integrating `raven-js <https://github.com/getsentry/raven-js>`__.
Additionally, `Sentry user feedback
form <https://docs.sentry.io/learn/user-feedback/>`__ could be
integrated into the Odoo client error dialog window to allow users
shortly describe what they were doing when things went wrong.
- **No database separation** -- This module functions by intercepting
all Odoo logging records in a running Odoo process. This means that
once installed in one database, it will intercept and report errors
for all Odoo databases, which are used on that Odoo server.
- **Frontend integration** -- In the future, it would be nice to add
Odoo client-side error reporting to this module as well, by
integrating `raven-js <https://github.com/getsentry/raven-js>`__.
Additionally, `Sentry user feedback
form <https://docs.sentry.io/learn/user-feedback/>`__ could be
integrated into the Odoo client error dialog window to allow users
shortly describe what they were doing when things went wrong.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20sentry%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20sentry%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Expand All @@ -142,18 +142,19 @@ Authors
Contributors
------------

- Mohammed Barsi <[email protected]>
- Andrius Preimantas <[email protected]>
- Naglis Jonaitis <[email protected]>
- Atte Isopuro <[email protected]>
- Florian Mounier <[email protected]>
- Jon Ashton <[email protected]>
- Mark Schuit <[email protected]>
- Mohammed Barsi <[email protected]>
- Andrius Preimantas <[email protected]>
- Naglis Jonaitis <[email protected]>
- Atte Isopuro <[email protected]>
- Florian Mounier <[email protected]>
- Jon Ashton <[email protected]>
- Mark Schuit <[email protected]>
- Atchuthan <[email protected]>

Other credits
-------------

- Vauxoo
- Vauxoo

Maintainers
-----------
Expand Down Expand Up @@ -188,6 +189,6 @@ Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-barsi| |maintainer-naglis| |maintainer-versada| |maintainer-moylop260| |maintainer-fernandahf|

This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/17.0/sentry>`_ project on GitHub.
This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/18.0/sentry>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion sentry/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "Sentry",
"summary": "Report Odoo errors to Sentry",
"version": "17.0.1.0.0",
"version": "18.0.1.0.0",
"category": "Extra Tools",
"website": "https://github.com/OCA/server-tools",
"author": "Mohammed Barsi,"
Expand Down
2 changes: 1 addition & 1 deletion sentry/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def to_float_if_defined(value):

# Mapping of Odoo logging level -> Python stdlib logging library log level.
LOG_LEVEL_MAP = {
getattr(odoo.loglevels, "LOG_%s" % x): getattr(logging, x)
getattr(odoo.loglevels, f"LOG_{x}"): getattr(logging, x)
for x in ("CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG", "NOTSET")
}
DEFAULT_LOG_LEVEL = "warn"
Expand Down
2 changes: 1 addition & 1 deletion sentry/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def initialize_sentry(config):
)
options = {}
for option in const.get_sentry_options():
value = config.get("sentry_%s" % option.key, option.default)
value = config.get(f"sentry_{option.key}", option.default)
if isinstance(option.converter, abc.Callable):
value = option.converter(value)
options[option.key] = value
Expand Down
1 change: 1 addition & 0 deletions sentry/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
- Florian Mounier \<<[email protected]>\>
- Jon Ashton \<<[email protected]>\>
- Mark Schuit \<<[email protected]>\>
- Atchuthan \<<[email protected]>\>
18 changes: 11 additions & 7 deletions sentry/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -274,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -300,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -368,7 +369,7 @@ <h1 class="title">Sentry</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:fb1e0787f353def76b80f3aae5948d0b7a9b01d35f2f738a5b96fa28588bab0e
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-tools/tree/17.0/sentry"><img alt="OCA/server-tools" src="https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-tools-17-0/server-tools-17-0-sentry"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/server-tools&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-tools/tree/18.0/sentry"><img alt="OCA/server-tools" src="https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-tools-18-0/server-tools-18-0-sentry"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/server-tools&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allows painless <a class="reference external" href="https://sentry.io/">Sentry</a> integration
with Odoo.</p>
<p><strong>Table of contents</strong></p>
Expand Down Expand Up @@ -466,7 +467,7 @@ <h1><a class="toc-backref" href="#toc-entry-6">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-tools/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/server-tools/issues/new?body=module:%20sentry%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/server-tools/issues/new?body=module:%20sentry%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand All @@ -490,6 +491,7 @@ <h2><a class="toc-backref" href="#toc-entry-9">Contributors</a></h2>
<li>Florian Mounier &lt;<a class="reference external" href="mailto:florian.mounier&#64;akretion.com">florian.mounier&#64;akretion.com</a>&gt;</li>
<li>Jon Ashton &lt;<a class="reference external" href="mailto:jon&#64;monkeyinferno.com">jon&#64;monkeyinferno.com</a>&gt;</li>
<li>Mark Schuit &lt;<a class="reference external" href="mailto:mark&#64;gig.solutions">mark&#64;gig.solutions</a>&gt;</li>
<li>Atchuthan &lt;<a class="reference external" href="mailto:atchuthan&#64;sodexis.com">atchuthan&#64;sodexis.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="other-credits">
Expand All @@ -501,13 +503,15 @@ <h2><a class="toc-backref" href="#toc-entry-10">Other credits</a></h2>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-11">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainers</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/barsi"><img alt="barsi" src="https://github.com/barsi.png?size=40px" /></a> <a class="reference external image-reference" href="https://github.com/naglis"><img alt="naglis" src="https://github.com/naglis.png?size=40px" /></a> <a class="reference external image-reference" href="https://github.com/versada"><img alt="versada" src="https://github.com/versada.png?size=40px" /></a> <a class="reference external image-reference" href="https://github.com/moylop260"><img alt="moylop260" src="https://github.com/moylop260.png?size=40px" /></a> <a class="reference external image-reference" href="https://github.com/fernandahf"><img alt="fernandahf" src="https://github.com/fernandahf.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-tools/tree/17.0/sentry">OCA/server-tools</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-tools/tree/18.0/sentry">OCA/server-tools</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions sentry/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,13 @@ def log(self, level, msg, exc_info=None):
def assertEventCaptured(self, client, event_level, event_msg):
self.assertTrue(
client.transport.has_event(event_level, event_msg),
msg='Event: "%s" was not captured' % event_msg,
msg=f"Event: {event_msg} was not captured",
)

def assertEventNotCaptured(self, client, event_level, event_msg):
self.assertFalse(
client.transport.has_event(event_level, event_msg),
msg='Event: "%s" was captured' % event_msg,
msg=f"Event: {event_msg} was captured",
)

def test_initialize_raven_sets_dsn(self):
Expand Down Expand Up @@ -203,7 +203,7 @@ def test_exclude_logger(self):
)
client = initialize_sentry(config)._client
client.transport = InMemoryTransport({"dsn": self.dsn})
level, msg = logging.ERROR, "Test exclude logger %s" % __name__
level, msg = logging.ERROR, f"Test exclude logger {__name__}"
self.log(level, msg)
level = "error"
# Revert ignored logger so it doesn't affect other tests
Expand Down

0 comments on commit c399919

Please sign in to comment.