Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions MIGRATION_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Looking to upgrade from Sentry SDK 2.x to 3.x? Here's a comprehensive list of wh
- The `Profile()` constructor does not accept a `hub` parameter anymore.
- A `Profile` object does not have a `.hub` property anymore.
- `sentry_sdk.continue_trace` no longer returns a `Transaction` and is now a context manager.
- Redis integration: In Redis pipeline spans there is no `span["data"]["redis.commands"]` that contains a dict `{"count": 3, "first_ten": ["cmd1", "cmd2", ...]}` but instead `span["data"]["redis.commands.count"]` (containing `3`) and `span["data"]["redis.commands.first_ten"]` (containing `["cmd1", "cmd2", ...]`).

### Removed

Expand Down
9 changes: 2 additions & 7 deletions sentry_sdk/integrations/redis/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,8 @@ def _set_pipeline_data(
command = get_command_args_fn(arg)
commands.append(_get_safe_command(command[0], command[1:]))

span.set_data(
"redis.commands",
{
"count": len(command_stack),
"first_ten": commands,
},
)
span.set_data("redis.commands.count", len(command_stack))
span.set_data("redis.commands.first_ten", commands)


def _set_client_data(span, is_cluster, name, *args):
Expand Down
6 changes: 2 additions & 4 deletions tests/integrations/redis/asyncio/test_redis_asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,10 @@ async def test_async_redis_pipeline(
(span,) = event["spans"]
assert span["op"] == "db.redis"
assert span["description"] == "redis.pipeline.execute"
assert span["data"]["redis.commands.count"] == 3
assert span["data"]["redis.commands.first_ten"] == expected_first_ten
assert span["data"] == ApproxDict(
{
"redis.commands": {
"count": 3,
"first_ten": expected_first_ten,
},
SPANDATA.DB_SYSTEM: "redis",
SPANDATA.DB_NAME: "0",
SPANDATA.SERVER_ADDRESS: connection.connection_pool.connection_kwargs.get(
Expand Down
6 changes: 2 additions & 4 deletions tests/integrations/redis/cluster/test_redis_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,10 @@ def test_rediscluster_pipeline(
(span,) = event["spans"]
assert span["op"] == "db.redis"
assert span["description"] == "redis.pipeline.execute"
assert span["data"]["redis.commands.count"] == 3
assert span["data"]["redis.commands.first_ten"] == expected_first_ten
assert span["data"] == ApproxDict(
{
"redis.commands": {
"count": 3,
"first_ten": expected_first_ten,
},
SPANDATA.DB_SYSTEM: "redis",
# ClusterNode converts localhost to 127.0.0.1
SPANDATA.SERVER_ADDRESS: "127.0.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,10 @@ async def test_async_redis_pipeline(
(span,) = event["spans"]
assert span["op"] == "db.redis"
assert span["description"] == "redis.pipeline.execute"
assert span["data"]["redis.commands.count"] == 3
assert span["data"]["redis.commands.first_ten"] == expected_first_ten
assert span["data"] == ApproxDict(
{
"redis.commands": {
"count": 3,
"first_ten": expected_first_ten,
},
SPANDATA.DB_SYSTEM: "redis",
# ClusterNode converts localhost to 127.0.0.1
SPANDATA.SERVER_ADDRESS: "127.0.0.1",
Expand Down
6 changes: 2 additions & 4 deletions tests/integrations/redis/test_redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,8 @@ def test_redis_pipeline(
assert span["op"] == "db.redis"
assert span["description"] == "redis.pipeline.execute"
assert span["data"][SPANDATA.DB_SYSTEM] == "redis"
assert span["data"]["redis.commands"] == {
"count": 3,
"first_ten": expected_first_ten,
}
assert span["data"]["redis.commands.count"] == 3
assert span["data"]["redis.commands.first_ten"] == expected_first_ten
assert span["tags"] == {
"redis.transaction": is_transaction,
"redis.is_cluster": False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,10 @@ def test_rediscluster_pipeline(
(span,) = event["spans"]
assert span["op"] == "db.redis"
assert span["description"] == "redis.pipeline.execute"
assert span["data"]["redis.commands.count"] == 3
assert span["data"]["redis.commands.first_ten"] == expected_first_ten
assert span["data"] == ApproxDict(
{
"redis.commands": {
"count": 3,
"first_ten": expected_first_ten,
},
SPANDATA.DB_SYSTEM: "redis",
SPANDATA.DB_NAME: "1",
SPANDATA.SERVER_ADDRESS: "localhost",
Expand Down Expand Up @@ -158,12 +156,11 @@ def test_db_connection_attributes_pipeline(
(span,) = event["spans"]
assert span["op"] == "db.redis"
assert span["description"] == "redis.pipeline.execute"
assert span["data"]["redis.commands.count"] == 1
assert span["data"]["redis.commands.first_ten"] == ["GET 'foo'"]

assert span["data"] == ApproxDict(
{
"redis.commands": {
"count": 1,
"first_ten": ["GET 'foo'"],
},
SPANDATA.DB_SYSTEM: "redis",
SPANDATA.DB_NAME: "1",
SPANDATA.SERVER_ADDRESS: "localhost",
Expand Down