You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OpenTelemetry Tornado instrumentation throws AttributeError when unpatch_handler_class is called on a child class after its parent class has been instrumented. This occurs due to inconsistent behavior between getattr and delattr when handling class variables in inheritance.
Describe your environment
Python version: Python 3.12
Package version:
What happened?
OpenTelemetry Tornado instrumentation throws
AttributeError
whenunpatch_handler_class
is called on a child class after its parent class has been instrumented. This occurs due to inconsistent behavior betweengetattr
anddelattr
when handling class variables in inheritance.Steps to Reproduce
Expected Result
The code should execute without errors, properly handling the unpatching of the child handler class.
Actual Result
An
AttributeError
is raised:Additional context
The issue stems from inconsistent behavior in Python's attribute handling:
getattr(cls, '_otel_patched_key')
traverses the inheritance chaindelattr(cls, '_otel_patched_key')
only operates on the immediate classThe sequence causing the error:
_otel_patched_key
unpatch_handler_class
getattr
check passes (finds attribute in parent)delattr
fails (can't find attribute in child)Would you like to implement a fix?
None
The text was updated successfully, but these errors were encountered: