@@ -350,27 +350,28 @@ def _noop_execute(self, cursor: Any) -> Any:
350350
351351 def _replay_execute (self , cursor : Any , sdk : TuskDrift , query_str : str , params : Any ) -> Any :
352352 """Handle REPLAY mode for execute - fetch mock from CLI."""
353- span_info = SpanUtils .create_span (CreateSpanOptions (
354- name = "psycopg.query" ,
355- kind = OTelSpanKind .CLIENT ,
356- attributes = {
357- TdSpanAttributes .NAME : "psycopg.query" ,
358- TdSpanAttributes .PACKAGE_NAME : "psycopg" ,
359- TdSpanAttributes .INSTRUMENTATION_NAME : "PsycopgInstrumentation" ,
360- TdSpanAttributes .SUBMODULE_NAME : "query" ,
361- TdSpanAttributes .PACKAGE_TYPE : PackageType .PG .name ,
362- TdSpanAttributes .IS_PRE_APP_START : not sdk .app_ready ,
363- },
364- is_pre_app_start = not sdk .app_ready ,
365- ))
353+ span_info = SpanUtils .create_span (
354+ CreateSpanOptions (
355+ name = "psycopg.query" ,
356+ kind = OTelSpanKind .CLIENT ,
357+ attributes = {
358+ TdSpanAttributes .NAME : "psycopg.query" ,
359+ TdSpanAttributes .PACKAGE_NAME : "psycopg" ,
360+ TdSpanAttributes .INSTRUMENTATION_NAME : "PsycopgInstrumentation" ,
361+ TdSpanAttributes .SUBMODULE_NAME : "query" ,
362+ TdSpanAttributes .PACKAGE_TYPE : PackageType .PG .name ,
363+ TdSpanAttributes .IS_PRE_APP_START : not sdk .app_ready ,
364+ },
365+ is_pre_app_start = not sdk .app_ready ,
366+ )
367+ )
366368
367369 if not span_info :
368370 raise RuntimeError ("Error creating span in replay mode" )
369371
370372 with SpanUtils .with_span (span_info ):
371373 mock_result = self ._try_get_mock (
372- sdk , query_str , params ,
373- span_info .trace_id , span_info .span_id , span_info .parent_span_id
374+ sdk , query_str , params , span_info .trace_id , span_info .span_id , span_info .parent_span_id
374375 )
375376
376377 if mock_result is None :
@@ -397,19 +398,21 @@ def _record_execute(
397398 kwargs : dict ,
398399 ) -> Any :
399400 """Handle RECORD mode for execute - create span and execute query."""
400- span_info = SpanUtils .create_span (CreateSpanOptions (
401- name = "psycopg.query" ,
402- kind = OTelSpanKind .CLIENT ,
403- attributes = {
404- TdSpanAttributes .NAME : "psycopg.query" ,
405- TdSpanAttributes .PACKAGE_NAME : "psycopg" ,
406- TdSpanAttributes .INSTRUMENTATION_NAME : "PsycopgInstrumentation" ,
407- TdSpanAttributes .SUBMODULE_NAME : "query" ,
408- TdSpanAttributes .PACKAGE_TYPE : PackageType .PG .name ,
409- TdSpanAttributes .IS_PRE_APP_START : is_pre_app_start ,
410- },
411- is_pre_app_start = is_pre_app_start ,
412- ))
401+ span_info = SpanUtils .create_span (
402+ CreateSpanOptions (
403+ name = "psycopg.query" ,
404+ kind = OTelSpanKind .CLIENT ,
405+ attributes = {
406+ TdSpanAttributes .NAME : "psycopg.query" ,
407+ TdSpanAttributes .PACKAGE_NAME : "psycopg" ,
408+ TdSpanAttributes .INSTRUMENTATION_NAME : "PsycopgInstrumentation" ,
409+ TdSpanAttributes .SUBMODULE_NAME : "query" ,
410+ TdSpanAttributes .PACKAGE_TYPE : PackageType .PG .name ,
411+ TdSpanAttributes .IS_PRE_APP_START : is_pre_app_start ,
412+ },
413+ is_pre_app_start = is_pre_app_start ,
414+ )
415+ )
413416
414417 if not span_info :
415418 # Fallback to original call if span creation fails
@@ -464,27 +467,28 @@ def _traced_executemany(
464467
465468 def _replay_executemany (self , cursor : Any , sdk : TuskDrift , query_str : str , params_list : list ) -> Any :
466469 """Handle REPLAY mode for executemany - fetch mock from CLI."""
467- span_info = SpanUtils .create_span (CreateSpanOptions (
468- name = "psycopg.query" ,
469- kind = OTelSpanKind .CLIENT ,
470- attributes = {
471- TdSpanAttributes .NAME : "psycopg.query" ,
472- TdSpanAttributes .PACKAGE_NAME : "psycopg" ,
473- TdSpanAttributes .INSTRUMENTATION_NAME : "PsycopgInstrumentation" ,
474- TdSpanAttributes .SUBMODULE_NAME : "query" ,
475- TdSpanAttributes .PACKAGE_TYPE : PackageType .PG .name ,
476- TdSpanAttributes .IS_PRE_APP_START : not sdk .app_ready ,
477- },
478- is_pre_app_start = not sdk .app_ready ,
479- ))
470+ span_info = SpanUtils .create_span (
471+ CreateSpanOptions (
472+ name = "psycopg.query" ,
473+ kind = OTelSpanKind .CLIENT ,
474+ attributes = {
475+ TdSpanAttributes .NAME : "psycopg.query" ,
476+ TdSpanAttributes .PACKAGE_NAME : "psycopg" ,
477+ TdSpanAttributes .INSTRUMENTATION_NAME : "PsycopgInstrumentation" ,
478+ TdSpanAttributes .SUBMODULE_NAME : "query" ,
479+ TdSpanAttributes .PACKAGE_TYPE : PackageType .PG .name ,
480+ TdSpanAttributes .IS_PRE_APP_START : not sdk .app_ready ,
481+ },
482+ is_pre_app_start = not sdk .app_ready ,
483+ )
484+ )
480485
481486 if not span_info :
482487 raise RuntimeError ("Error creating span in replay mode" )
483488
484489 with SpanUtils .with_span (span_info ):
485490 mock_result = self ._try_get_mock (
486- sdk , query_str , {"_batch" : params_list },
487- span_info .trace_id , span_info .span_id , span_info .parent_span_id
491+ sdk , query_str , {"_batch" : params_list }, span_info .trace_id , span_info .span_id , span_info .parent_span_id
488492 )
489493
490494 if mock_result is None :
@@ -514,19 +518,21 @@ def _record_executemany(
514518 kwargs : dict ,
515519 ) -> Any :
516520 """Handle RECORD mode for executemany - create span and execute query."""
517- span_info = SpanUtils .create_span (CreateSpanOptions (
518- name = "psycopg.query" ,
519- kind = OTelSpanKind .CLIENT ,
520- attributes = {
521- TdSpanAttributes .NAME : "psycopg.query" ,
522- TdSpanAttributes .PACKAGE_NAME : "psycopg" ,
523- TdSpanAttributes .INSTRUMENTATION_NAME : "PsycopgInstrumentation" ,
524- TdSpanAttributes .SUBMODULE_NAME : "query" ,
525- TdSpanAttributes .PACKAGE_TYPE : PackageType .PG .name ,
526- TdSpanAttributes .IS_PRE_APP_START : is_pre_app_start ,
527- },
528- is_pre_app_start = is_pre_app_start ,
529- ))
521+ span_info = SpanUtils .create_span (
522+ CreateSpanOptions (
523+ name = "psycopg.query" ,
524+ kind = OTelSpanKind .CLIENT ,
525+ attributes = {
526+ TdSpanAttributes .NAME : "psycopg.query" ,
527+ TdSpanAttributes .PACKAGE_NAME : "psycopg" ,
528+ TdSpanAttributes .INSTRUMENTATION_NAME : "PsycopgInstrumentation" ,
529+ TdSpanAttributes .SUBMODULE_NAME : "query" ,
530+ TdSpanAttributes .PACKAGE_TYPE : PackageType .PG .name ,
531+ TdSpanAttributes .IS_PRE_APP_START : is_pre_app_start ,
532+ },
533+ is_pre_app_start = is_pre_app_start ,
534+ )
535+ )
530536
531537 if not span_info :
532538 # Fallback to original call if span creation fails
0 commit comments