From 5d3065e4af33c6149b8412476261d7dd9cb38fee Mon Sep 17 00:00:00 2001 From: Florian Mounier Date: Tue, 4 Jan 2022 12:20:06 +0100 Subject: [PATCH] [FIX] sentry: warn about sentry_transport only if it is specified in config --- sentry/const.py | 6 ------ sentry/hooks.py | 7 +++++++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/sentry/const.py b/sentry/const.py index e1829ebb0..c3135a9df 100644 --- a/sentry/const.py +++ b/sentry/const.py @@ -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) diff --git a/sentry/hooks.py b/sentry/hooks.py index 8539d5a18..789f93239 100644 --- a/sentry/hooks.py +++ b/sentry/hooks.py @@ -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)