|
76 | 76 | from wrapt import ObjectProxy |
77 | 77 | from wrapt import wrap_function_wrapper as _wrap |
78 | 78 |
|
79 | | -from opentelemetry.auto_instrumentation.instrumentor import BaseInstrumentor |
80 | 79 | from opentelemetry.ext.pyramid.callbacks import ( |
81 | 80 | SETTING_TRACE_ENABLED, |
82 | 81 | TWEEN_NAME, |
83 | 82 | trace_tween_factory, |
84 | 83 | ) |
85 | 84 | from opentelemetry.ext.pyramid.version import __version__ |
| 85 | +from opentelemetry.instrumentation.instrumentor import BaseInstrumentor |
| 86 | +from opentelemetry.instrumentation.utils import unwrap |
86 | 87 | from opentelemetry.trace import TracerProvider, get_tracer |
87 | 88 |
|
88 | 89 |
|
@@ -113,17 +114,6 @@ def traced_init(wrapped, instance, args, kwargs): |
113 | 114 | instance.include("opentelemetry.ext.pyramid.callbacks") |
114 | 115 |
|
115 | 116 |
|
116 | | -def unwrap(obj, attr: str): |
117 | | - """Given a function that was wrapped by wrapt.wrap_function_wrapper, unwrap it |
118 | | - Args: |
119 | | - obj: Object that holds a reference to the wrapped function |
120 | | - attr (str): Name of the wrapped function |
121 | | - """ |
122 | | - func = getattr(obj, attr, None) |
123 | | - if func and isinstance(func, ObjectProxy) and hasattr(func, "__wrapped__"): |
124 | | - setattr(obj, attr, func.__wrapped__) |
125 | | - |
126 | | - |
127 | 117 | class PyramidInstrumentor(BaseInstrumentor): |
128 | 118 | def _instrument(self, **kwargs): |
129 | 119 | """Integrate with Pyramid Python library. |
|
0 commit comments