chore: Deprecate description truncation option for Redis spans by alexander-alderman-webb · Pull Request #5073 · getsentry/sentry-python · GitHub
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
12 changes: 11 additions & 1 deletion sentry_sdk/integrations/redis/__init__.py
2 changes: 1 addition & 1 deletion sentry_sdk/integrations/redis/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
]
_MAX_NUM_ARGS = 10 # Trim argument lists to this many values
_MAX_NUM_COMMANDS = 10 # Trim command lists to this many values
_DEFAULT_MAX_DATA_SIZE = 1024
_DEFAULT_MAX_DATA_SIZE = None
5 changes: 1 addition & 4 deletions sentry_sdk/integrations/redis/modules/caches.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,7 @@ def _get_cache_span_description(redis_command, args, kwargs, integration):
# type: (str, tuple[Any, ...], dict[str, Any], RedisIntegration) -> str
description = _key_as_string(_get_safe_key(redis_command, args, kwargs))

data_should_be_truncated = (
integration.max_data_size and len(description) > integration.max_data_size
)
if data_should_be_truncated:
if integration.max_data_size and len(description) > integration.max_data_size:
description = description[: integration.max_data_size - len("...")] + "..."

return description
Expand Down
5 changes: 1 addition & 4 deletions sentry_sdk/integrations/redis/modules/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ def _get_db_span_description(integration, command_name, args):
with capture_internal_exceptions():
description = _get_safe_command(command_name, args)

data_should_be_truncated = (
integration.max_data_size and len(description) > integration.max_data_size
)
if data_should_be_truncated:
if integration.max_data_size and len(description) > integration.max_data_size:
description = description[: integration.max_data_size - len("...")] + "..."

return description
Expand Down
8 changes: 3 additions & 5 deletions tests/integrations/redis/test_redis.py