@@ -89,12 +89,18 @@ def _inner(*args: "P.args", **kwargs: "P.kwargs") -> "T":
8989 breadcrumb_data = {
9090 SPANDATA .DB_SYSTEM : "clickhouse" ,
9191 SPANDATA .DB_NAME : connection .database ,
92- SPANDATA .DB_DRIVER_NAME : "clickhouse-driver" ,
9392 SPANDATA .SERVER_ADDRESS : connection .host ,
9493 SPANDATA .SERVER_PORT : connection .port ,
9594 SPANDATA .DB_USER : connection .user ,
9695 }
97- if params :
96+ if params and (
97+ (
98+ has_data_collection_enabled (client .options )
99+ and client .options ["data_collection" ]["database_query_data" ]
100+ )
101+ or not has_data_collection_enabled (client .options )
102+ and should_send_default_pii ()
103+ ):
98104 breadcrumb_data ["db.params" ] = params
99105
100106 connection ._breadcrumb_data = breadcrumb_data
@@ -157,7 +163,9 @@ def _inner_end(*args: "P.args", **kwargs: "P.kwargs") -> "T":
157163 if (
158164 has_data_collection_enabled (client_options )
159165 and client_options ["data_collection" ]["database_query_data" ]
160- or should_send_default_pii ()
166+ ) or (
167+ not has_data_collection_enabled (client_options )
168+ and should_send_default_pii ()
161169 ):
162170 breadcrumb_data = {"db.result" : res , ** breadcrumb_data }
163171
0 commit comments