diff --git a/CHANGES.md b/CHANGES.md index 0f14cf7ab9..34b1f11120 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -27,6 +27,10 @@ sentry-sdk==0.10.1 A major release `N` implies the previous release `N-1` will no longer receive updates. We generally do not backport bugfixes to older versions unless they are security relevant. However, feel free to ask for backports of specific commits on the bugtracker. +## 0.16.1 + +* Flask integration: Fix a bug that prevented custom tags from being attached to transactions. + ## 0.16.0 * Redis integration: add tags for more commands diff --git a/codecov.yml b/codecov.yml index 69cb76019a..1989f1cd03 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1 +1,9 @@ +coverage: + status: + project: + default: false + patch: + default: false + python: + target: 90% comment: false diff --git a/docs/conf.py b/docs/conf.py index 25a82fbaa7..b763f02728 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -22,7 +22,7 @@ copyright = u"2019, Sentry Team and Contributors" author = u"Sentry Team and Contributors" -release = "0.16.0" +release = "0.16.1" version = ".".join(release.split(".")[:2]) # The short X.Y version. diff --git a/sentry_sdk/consts.py b/sentry_sdk/consts.py index 805b1ffd82..f67daefcb2 100644 --- a/sentry_sdk/consts.py +++ b/sentry_sdk/consts.py @@ -89,7 +89,7 @@ def _get_default_options(): del _get_default_options -VERSION = "0.16.0" +VERSION = "0.16.1" SDK_INFO = { "name": "sentry.python", "version": VERSION, diff --git a/sentry_sdk/integrations/flask.py b/sentry_sdk/integrations/flask.py index ef6ae0e4f0..13ec0dcfc8 100644 --- a/sentry_sdk/integrations/flask.py +++ b/sentry_sdk/integrations/flask.py @@ -37,8 +37,6 @@ __version__ as FLASK_VERSION, ) from flask.signals import ( - appcontext_pushed, - appcontext_tearing_down, got_request_exception, request_started, ) @@ -74,8 +72,6 @@ def setup_once(): if version < (0, 11): raise DidNotEnable("Flask 0.11 or newer is required.") - appcontext_pushed.connect(_push_appctx) - appcontext_tearing_down.connect(_pop_appctx) request_started.connect(_request_started) got_request_exception.connect(_capture_exception) @@ -93,26 +89,6 @@ def sentry_patched_wsgi_app(self, environ, start_response): Flask.__call__ = sentry_patched_wsgi_app # type: ignore -def _push_appctx(*args, **kwargs): - # type: (*Flask, **Any) -> None - hub = Hub.current - if hub.get_integration(FlaskIntegration) is not None: - # always want to push scope regardless of whether WSGI app might already - # have (not the case for CLI for example) - scope_manager = hub.push_scope() - scope_manager.__enter__() - _app_ctx_stack.top.sentry_sdk_scope_manager = scope_manager - with hub.configure_scope() as scope: - scope._name = "flask" - - -def _pop_appctx(*args, **kwargs): - # type: (*Flask, **Any) -> None - scope_manager = getattr(_app_ctx_stack.top, "sentry_sdk_scope_manager", None) - if scope_manager is not None: - scope_manager.__exit__(None, None, None) - - def _request_started(sender, **kwargs): # type: (Flask, **Any) -> None hub = Hub.current diff --git a/setup.py b/setup.py index 86ae84c9b0..931b4428e0 100644 --- a/setup.py +++ b/setup.py @@ -12,11 +12,11 @@ setup( name="sentry-sdk", - version="0.16.0", + version="0.16.1", author="Sentry Team and Contributors", - author_email="hello@getsentry.com", + author_email="hello@sentry.io", url="https://github.com/getsentry/sentry-python", - description="Python client for Sentry (https://getsentry.com)", + description="Python client for Sentry (https://sentry.io)", long_description=__doc__, packages=find_packages(exclude=("tests", "tests.*")), # PEP 561 diff --git a/tests/integrations/flask/test_flask.py b/tests/integrations/flask/test_flask.py index 96d45af6a3..833a83c89b 100644 --- a/tests/integrations/flask/test_flask.py +++ b/tests/integrations/flask/test_flask.py @@ -12,6 +12,7 @@ from flask_login import LoginManager, login_user from sentry_sdk import ( + set_tag, configure_scope, capture_message, capture_exception, @@ -630,20 +631,34 @@ def zerodivision(e): def test_tracing_success(sentry_init, capture_events, app): sentry_init(traces_sample_rate=1.0, integrations=[flask_sentry.FlaskIntegration()]) + @app.before_request + def _(): + set_tag("before_request", "yes") + + @app.route("/message_tx") + def hi_tx(): + set_tag("view", "yes") + capture_message("hi") + return "ok" + events = capture_events() with app.test_client() as client: - response = client.get("/message") + response = client.get("/message_tx") assert response.status_code == 200 message_event, transaction_event = events assert transaction_event["type"] == "transaction" - assert transaction_event["transaction"] == "hi" + assert transaction_event["transaction"] == "hi_tx" assert transaction_event["contexts"]["trace"]["status"] == "ok" + assert transaction_event["tags"]["view"] == "yes" + assert transaction_event["tags"]["before_request"] == "yes" assert message_event["message"] == "hi" - assert message_event["transaction"] == "hi" + assert message_event["transaction"] == "hi_tx" + assert message_event["tags"]["view"] == "yes" + assert message_event["tags"]["before_request"] == "yes" def test_tracing_error(sentry_init, capture_events, app):