11"""Tracing manager for handling tracer implementations and function registry."""
22
33import logging
4- from typing import Any , Callable , List , Optional , Tuple
4+ from typing import Any , Callable , Optional
55
66from opentelemetry import context , trace
77from opentelemetry .trace import set_span_in_context
1212class UiPathTracingManager :
1313 """Static utility class to manage tracing implementations and decorated functions."""
1414
15- # Registry to track original functions, decorated functions, and their parameters
16- # Each entry is (original_func, decorated_func, params)
17- _traced_registry : List [Tuple [Callable [..., Any ], Callable [..., Any ], Any ]] = []
18-
1915 _current_span_provider : Optional [Callable [[], Any ]] = None
2016
2117 @classmethod
@@ -41,6 +37,7 @@ def get_parent_context():
4137 """
4238 # Always use the currently active OTel span if valid (recursion / children)
4339 current_span = trace .get_current_span ()
40+
4441 if current_span is not None and current_span .get_span_context ().is_valid :
4542 return set_span_in_context (current_span )
4643
@@ -54,18 +51,9 @@ def get_parent_context():
5451 logger .warning (f"Error getting current span from provider: { e } " )
5552
5653 # Last fallback
57- return context .get_current ()
58-
59- @classmethod
60- def register_traced_function (cls , original_func , decorated_func , params ):
61- """Register a function decorated with @traced and its parameters.
54+ ctx = context .get_current ()
6255
63- Args:
64- original_func: The original function before decoration
65- decorated_func: The function after decoration
66- params: The parameters used for tracing
67- """
68- cls ._traced_registry .append ((original_func , decorated_func , params ))
56+ return ctx
6957
7058
7159__all__ = ["UiPathTracingManager" ]
0 commit comments