diff --git a/sentry_sdk/integrations/redis.py b/sentry_sdk/integrations/redis.py index 0f23210b99..ef796bf88f 100644 --- a/sentry_sdk/integrations/redis.py +++ b/sentry_sdk/integrations/redis.py @@ -33,6 +33,9 @@ def sentry_patched_execute_command(self, name, *args, **kwargs): description = " ".join(description_parts) with hub.start_span(op="redis", description=description) as span: + if name: + span.set_tag("redis.command", name) + if name and args and name.lower() in ("get", "set", "setex", "setnx"): span.set_tag("redis.key", args[0]) diff --git a/sentry_sdk/tracing.py b/sentry_sdk/tracing.py index 0743c8ef43..e38b657602 100644 --- a/sentry_sdk/tracing.py +++ b/sentry_sdk/tracing.py @@ -394,7 +394,9 @@ def record_http_request(hub, url, method): def _maybe_create_breadcrumbs_from_span(hub, span): # type: (sentry_sdk.Hub, Span) -> None if span.op == "redis": - hub.add_breadcrumb(type="redis", category="redis", data=span._tags) + hub.add_breadcrumb( + message=span.description, type="redis", category="redis", data=span._tags + ) elif span.op == "http" and span.is_success(): hub.add_breadcrumb( type="http", @@ -406,6 +408,7 @@ def _maybe_create_breadcrumbs_from_span(hub, span): hub.add_breadcrumb( type="subprocess", category="subprocess", + message=span.description, data=span._data, hint={"popen_instance": span._data.get("popen_instance")}, ) diff --git a/tests/integrations/redis/test_redis.py b/tests/integrations/redis/test_redis.py index 50b5809ad8..117fac6d34 100644 --- a/tests/integrations/redis/test_redis.py +++ b/tests/integrations/redis/test_redis.py @@ -18,7 +18,8 @@ def test_basic(sentry_init, capture_events): assert crumb == { "category": "redis", - "data": {"redis.key": "foobar"}, + "message": "GET 'foobar'", + "data": {"redis.key": "foobar", "redis.command": "GET"}, "timestamp": crumb["timestamp"], "type": "redis", } diff --git a/tests/integrations/stdlib/test_subprocess.py b/tests/integrations/stdlib/test_subprocess.py index 00a0d1d8bc..1aa11f4fac 100644 --- a/tests/integrations/stdlib/test_subprocess.py +++ b/tests/integrations/stdlib/test_subprocess.py @@ -38,11 +38,12 @@ def __len__(self): True, marks=pytest.mark.skipif( platform.python_implementation() == "PyPy", - reason="https://github.com/getsentry/sentry-python/pull/449", + reason="https://bitbucket.org/pypy/pypy/issues/3050/subprocesspopen-only-accepts-sequences", ), ), False, ], + ids=("as_iterator", "as_list"), ) @pytest.mark.parametrize("env_mapping", [None, os.environ, ImmutableDict(os.environ)]) @pytest.mark.parametrize("with_cwd", [True, False]) @@ -126,10 +127,14 @@ def test_subprocess_basic( assert crumb == { "category": "subprocess", "data": data, + "message": crumb["message"], "timestamp": crumb["timestamp"], "type": "subprocess", } + if not iterator: + assert crumb["message"].startswith(sys.executable + " ") + assert transaction_event["type"] == "transaction" subprocess_span, = transaction_event["spans"]