@@ -121,9 +121,18 @@ def _set_client_data(span, is_cluster, name, *args):
121
121
def _set_db_data (span , connection_params ):
122
122
# type: (Span, Dict[str, Any]) -> None
123
123
span .set_data (SPANDATA .DB_SYSTEM , "redis" )
124
- span .set_data (SPANDATA .DB_NAME , text_type (connection_params .get ("db" )))
125
- span .set_data (SPANDATA .SERVER_ADDRESS , connection_params .get ("host" ))
126
- span .set_data (SPANDATA .SERVER_PORT , connection_params .get ("port" ))
124
+
125
+ db = connection_params .get ("db" )
126
+ if db is not None :
127
+ span .set_data (SPANDATA .DB_NAME , text_type (db ))
128
+
129
+ host = connection_params .get ("host" )
130
+ if host is not None :
131
+ span .set_data (SPANDATA .SERVER_ADDRESS , host )
132
+
133
+ port = connection_params .get ("port" )
134
+ if port is not None :
135
+ span .set_data (SPANDATA .SERVER_PORT , port )
127
136
128
137
129
138
def patch_redis_pipeline (pipeline_cls , is_cluster , get_command_args_fn ):
@@ -140,20 +149,15 @@ def sentry_patched_execute(self, *args, **kwargs):
140
149
with hub .start_span (
141
150
op = OP .DB_REDIS , description = "redis.pipeline.execute"
142
151
) as span :
143
- # with capture_internal_exceptions():
144
- # import ipdb; ipdb.set_trace()
145
- print ("#####################################" )
146
- print (dir (self .connection_pool ))
147
- print ("#####################################" )
148
- print (self .connection_pool )
149
- _set_db_data (span , self .connection_pool .connection_kwargs )
150
- _set_pipeline_data (
151
- span ,
152
- is_cluster ,
153
- get_command_args_fn ,
154
- self .transaction ,
155
- self .command_stack ,
156
- )
152
+ with capture_internal_exceptions ():
153
+ _set_db_data (span , self .connection_pool .connection_kwargs )
154
+ _set_pipeline_data (
155
+ span ,
156
+ is_cluster ,
157
+ get_command_args_fn ,
158
+ self .transaction ,
159
+ self .command_stack ,
160
+ )
157
161
158
162
return old_execute (self , * args , ** kwargs )
159
163
0 commit comments