chore: Deprecate description truncation option for Redis spans (#5073) · gitcommit90/sentry-python@c4071b3 · GitHub
Skip to content

Commit c4071b3

Browse files
chore: Deprecate description truncation option for Redis spans (getsentry#5073)
Set the default value of the `max_data_size` parameter of `RedisIntegration` to `None`, so that Redis span descriptions are not truncated by default. Deprecate the parameter and announce its removal in the next major release. Closes getsentry#4990
1 parent 25999b5 commit c4071b3

5 files changed

Lines changed: 17 additions & 15 deletions

File tree

sentry_sdk/integrations/redis/__init__.py

Lines changed: 11 additions & 1 deletion

sentry_sdk/integrations/redis/consts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
]
1717
_MAX_NUM_ARGS = 10 # Trim argument lists to this many values
1818
_MAX_NUM_COMMANDS = 10 # Trim command lists to this many values
19-
_DEFAULT_MAX_DATA_SIZE = 1024
19+
_DEFAULT_MAX_DATA_SIZE = None

sentry_sdk/integrations/redis/modules/caches.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,7 @@ def _get_cache_span_description(redis_command, args, kwargs, integration):
6666
# type: (str, tuple[Any, ...], dict[str, Any], RedisIntegration) -> str
6767
description = _key_as_string(_get_safe_key(redis_command, args, kwargs))
6868

69-
data_should_be_truncated = (
70-
integration.max_data_size and len(description) > integration.max_data_size
71-
)
72-
if data_should_be_truncated:
69+
if integration.max_data_size and len(description) > integration.max_data_size:
7370
description = description[: integration.max_data_size - len("...")] + "..."
7471

7572
return description

sentry_sdk/integrations/redis/modules/queries.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,7 @@ def _get_db_span_description(integration, command_name, args):
3434
with capture_internal_exceptions():
3535
description = _get_safe_command(command_name, args)
3636

37-
data_should_be_truncated = (
38-
integration.max_data_size and len(description) > integration.max_data_size
39-
)
40-
if data_should_be_truncated:
37+
if integration.max_data_size and len(description) > integration.max_data_size:
4138
description = description[: integration.max_data_size - len("...")] + "..."
4239

4340
return description

tests/integrations/redis/test_redis.py

Lines changed: 3 additions & 5 deletions

0 commit comments

Comments
 (0)