@@ -212,11 +212,9 @@ def with_cnx_span_attached(method: Callable) -> Callable:
212
212
213
213
def wrapper (cnx : "MySQLConnectionAbstract" , * args : Any , ** kwargs : Any ) -> Any :
214
214
"""Connection span attacher decorator."""
215
- with (
216
- trace .use_span (cnx ._span , end_on_exit = False )
217
- if cnx ._span and cnx ._span .is_recording ()
218
- else nullcontext ()
219
- ):
215
+ with trace .use_span (
216
+ cnx ._span , end_on_exit = False
217
+ ) if cnx ._span and cnx ._span .is_recording () else nullcontext ():
220
218
return method (cnx , * args , ** kwargs )
221
219
222
220
return wrapper
@@ -237,16 +235,12 @@ def wrapper(cnx: TracedMySQLConnection, *args: Any, **kwargs: Any) -> Any:
237
235
"connection_type" : cnx .get_wrapped_class (),
238
236
}
239
237
240
- with (
241
- cnx ._tracer .start_as_current_span (
242
- name = method .__name__ .upper (),
243
- kind = trace .SpanKind .CLIENT ,
244
- links = [trace .Link (cnx ._span .get_span_context ())],
245
- attributes = query_span_attributes ,
246
- )
247
- if cnx ._span and cnx ._span .is_recording ()
248
- else nullcontext ()
249
- ):
238
+ with cnx ._tracer .start_as_current_span (
239
+ name = method .__name__ .upper (),
240
+ kind = trace .SpanKind .CLIENT ,
241
+ links = [trace .Link (cnx ._span .get_span_context ())],
242
+ attributes = query_span_attributes ,
243
+ ) if cnx ._span and cnx ._span .is_recording () else nullcontext ():
250
244
return method (cnx , * args , ** kwargs )
251
245
252
246
return wrapper
0 commit comments