From bffaeda45deb019e844cba368b21a8beb9e8d5ff Mon Sep 17 00:00:00 2001 From: Daniel Szoke Date: Thu, 2 Nov 2023 15:10:41 +0100 Subject: [PATCH] Handle missing `connection_kwargs` in `patch_redis_client` (#2482) --- sentry_sdk/integrations/redis/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sentry_sdk/integrations/redis/__init__.py b/sentry_sdk/integrations/redis/__init__.py index f6c4f186ff..07e08ccd7a 100644 --- a/sentry_sdk/integrations/redis/__init__.py +++ b/sentry_sdk/integrations/redis/__init__.py @@ -189,7 +189,11 @@ def sentry_patched_execute_command(self, name, *args, **kwargs): description = description[: integration.max_data_size - len("...")] + "..." with hub.start_span(op=OP.DB_REDIS, description=description) as span: - _set_db_data(span, self.connection_pool.connection_kwargs) + try: + _set_db_data(span, self.connection_pool.connection_kwargs) + except AttributeError: + pass # connections_kwargs may be missing in some cases + _set_client_data(span, is_cluster, name, *args) return old_execute_command(self, name, *args, **kwargs)