@@ -306,15 +306,15 @@ def autoinstrument_class(aclass):
306
306
"""Auto-instrument a class."""
307
307
308
308
t = tracers [0 ]
309
- module_name = f"{ aclass .__module__ } :{ aclass .__qualname__ } "
309
+ class_name = f"{ aclass .__module__ } :{ aclass .__qualname__ } "
310
310
311
- with t .start_as_current_span (f"auto_instrumentation.add : { module_name } " ):
311
+ with t .start_as_current_span (f"auto_instrumentation.add_class : { class_name } " ):
312
312
for method_name , method in aclass .__dict__ .items ():
313
313
if not callable (getattr (aclass , method_name )):
314
314
continue
315
315
316
316
with t .start_as_current_span (
317
- f"class.instrument:{ module_name } .{ method_name } "
317
+ f"class.instrument:{ class_name } .{ method_name } "
318
318
):
319
319
# Avoid RecursionError:
320
320
# 'maximum recursion depth exceeded in comparison'
@@ -333,16 +333,17 @@ def autoinstrument_class(aclass):
333
333
def autoinstrument_module (amodule ):
334
334
"""Autoinstrument the classes and functions in a module."""
335
335
336
- # Instrument the methods of the classes in the module
337
- for _ , aclass in inspect .getmembers (amodule , inspect .isclass ):
338
- try :
339
- autoinstrument_class (aclass )
340
- except Exception :
341
- debug ("instrument_function: Exception %s" , traceback .format_exc ())
342
-
343
- # Instrument the module-level functions of the module
344
- for fname , afunction in inspect .getmembers (amodule , inspect .isfunction ):
345
- setattr (amodule , fname , instrument_function (afunction ))
336
+ with tracers [0 ].start_as_current_span (f"auto_instrumentation.add_module: { amodule } " ):
337
+ # Instrument the methods of the classes in the module
338
+ for _ , aclass in inspect .getmembers (amodule , inspect .isclass ):
339
+ try :
340
+ autoinstrument_class (aclass )
341
+ except Exception :
342
+ debug ("instrument_function: Exception %s" , traceback .format_exc ())
343
+
344
+ # Instrument the module-level functions of the module
345
+ for fname , afunction in inspect .getmembers (amodule , inspect .isfunction ):
346
+ setattr (amodule , fname , instrument_function (afunction ))
346
347
347
348
if inspect .ismodule (wrapped ):
348
349
autoinstrument_module (wrapped )
0 commit comments