Browse Source

Merge pull request #1127 from avoinsystems/option-sentry-release

[11.0] Sentry: Enable setting a release option directly
pull/1340/head
Pedro M. Baeza 6 years ago
committed by GitHub
parent
commit
6f4e268c9c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      sentry/README.rst
  2. 5
      sentry/__init__.py
  3. 2
      sentry/__manifest__.py
  4. 1
      sentry/const.py

9
sentry/README.rst

@ -71,9 +71,16 @@ configuration file:
HTTP request and user session (if available). This has no effect HTTP request and user session (if available). This has no effect
for Cron jobs, as no request/session is available inside a Cron job. for Cron jobs, as no request/session is available inside a Cron job.
``sentry_release`` Explicitly define a version to be sent as the release version to
Sentry. Useful in conjuntion with Sentry's "Resolve in the next
release"-functionality. Also useful if your production deployment
does not include any Git context from which a commit might be read.
Overrides *sentry_odoo_dir*.
``sentry_odoo_dir`` Absolute path to your Odoo installation directory. This is optional ``sentry_odoo_dir`` Absolute path to your Odoo installation directory. This is optional
and will only be used to extract the Odoo Git commit, which will be and will only be used to extract the Odoo Git commit, which will be
sent to Sentry, to allow to distinguish between Odoo updates. sent to Sentry, to allow to distinguish between Odoo updates.
Overridden by *sentry_release*
============================= ==================================================================== ========================================================== ============================= ==================================================================== ==========================================================
Other `client arguments Other `client arguments
@ -100,6 +107,7 @@ Below is an example of Odoo configuration file with *Odoo Sentry* options::
sentry_environment = production sentry_environment = production
sentry_auto_log_stacks = false sentry_auto_log_stacks = false
sentry_odoo_dir = /home/odoo/odoo/ sentry_odoo_dir = /home/odoo/odoo/
sentry_release = 1.3.2
Usage Usage
===== =====
@ -148,6 +156,7 @@ Contributors
* Mohammed Barsi <barsintod@gmail.com> * Mohammed Barsi <barsintod@gmail.com>
* Andrius Preimantas <andrius@versada.eu> * Andrius Preimantas <andrius@versada.eu>
* Naglis Jonaitis <naglis@versada.eu> * Naglis Jonaitis <naglis@versada.eu>
* Atte Isopuro <atte.isopuro@avoin.systems>
Maintainer Maintainer
---------- ----------

5
sentry/__init__.py

@ -43,8 +43,11 @@ def initialize_raven(config, client_cls=None):
enabled = config.get('sentry_enabled', False) enabled = config.get('sentry_enabled', False)
if not (HAS_RAVEN and enabled): if not (HAS_RAVEN and enabled):
return return
if config.get('sentry_odoo_dir') and config.get('sentry_release'):
_logger.debug('Both sentry_odoo_dir and sentry_release defined, choosing sentry_release')
options = { options = {
'release': get_odoo_commit(config.get('sentry_odoo_dir')),
'release': config.get('sentry_release', get_odoo_commit(config.get('sentry_odoo_dir'))),
} }
for option in const.get_sentry_options(): for option in const.get_sentry_options():
value = config.get('sentry_%s' % option.key, option.default) value = config.get('sentry_%s' % option.key, option.default)

2
sentry/__manifest__.py

@ -4,7 +4,7 @@
{ {
'name': 'Sentry', 'name': 'Sentry',
'summary': 'Report Odoo errors to Sentry', 'summary': 'Report Odoo errors to Sentry',
'version': '11.0.1.0.0',
'version': '11.0.1.1.0',
'category': 'Extra Tools', 'category': 'Extra Tools',
'website': 'https://odoo-community.org/', 'website': 'https://odoo-community.org/',
'author': 'Mohammed Barsi,' 'author': 'Mohammed Barsi,'

1
sentry/const.py

@ -86,4 +86,5 @@ def get_sentry_options():
'ignore_exceptions', DEFAULT_IGNORED_EXCEPTIONS, split_multiple), 'ignore_exceptions', DEFAULT_IGNORED_EXCEPTIONS, split_multiple),
SentryOption('processors', DEFAULT_PROCESSORS, split_multiple), SentryOption('processors', DEFAULT_PROCESSORS, split_multiple),
SentryOption('environment', None, None), SentryOption('environment', None, None),
SentryOption('release', None, None),
] ]
Loading…
Cancel
Save