[FIX] sentry: warn about sentry_transport only if it is specified in config

pull/2516/head
Florian Mounier 2022-01-04 12:20:06 +01:00 committed by prabakaran
parent d438a30b7d
commit 5d3065e4af
2 changed files with 7 additions and 6 deletions

View File

@ -2,7 +2,6 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import collections
import logging
import warnings
from sentry_sdk import HttpTransport
from sentry_sdk.consts import DEFAULT_OPTIONS
@ -61,11 +60,6 @@ DEFAULT_TRANSPORT = "threaded"
def select_transport(name=DEFAULT_TRANSPORT):
warnings.warn(
"`sentry_transport` has been deprecated. "
"Its not neccesary send it, will use `HttpTranport` by default.",
DeprecationWarning,
)
return {
"threaded": HttpTransport,
}.get(name, HttpTransport)

View File

@ -2,6 +2,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import logging
import warnings
from collections import abc
import odoo.http
@ -73,6 +74,12 @@ def initialize_sentry(config):
"Both sentry_odoo_dir and \
sentry_release defined, choosing sentry_release"
)
if config.get("sentry_transport"):
warnings.warn(
"`sentry_transport` has been deprecated. "
"Its not neccesary send it, will use `HttpTranport` by default.",
DeprecationWarning,
)
options = {}
for option in const.get_sentry_options():
value = config.get("sentry_%s" % option.key, option.default)