11"""Utilities for managing UiPath spans."""
22
33import logging
4- from typing import Callable , Dict , List , Optional
4+ from typing import Callable , Optional
55
66from opentelemetry import context , trace
77from opentelemetry .trace import Span , set_span_in_context
@@ -15,8 +15,8 @@ class SpanRegistry:
1515 MAX_HIERARCHY_DEPTH = 1000 # Hard limit for hierarchy traversal
1616
1717 def __init__ (self ):
18- self ._spans : Dict [int , Span ] = {} # span_id -> span
19- self ._parent_map : Dict [int , Optional [int ]] = {} # span_id -> parent_id
18+ self ._spans : dict [int , Span ] = {} # span_id -> span
19+ self ._parent_map : dict [int , Optional [int ]] = {} # span_id -> parent_id
2020
2121 def register_span (self , span : Span ) -> None :
2222 """Register a span and its parent relationship."""
@@ -116,7 +116,7 @@ class UiPathSpanUtils:
116116 """Static utility class to manage tracing implementations and decorated functions."""
117117
118118 _current_span_provider : Optional [Callable [[], Optional [Span ]]] = None
119- _current_span_ancestors_provider : Optional [Callable [[], List [Span ]]] = None
119+ _current_span_ancestors_provider : Optional [Callable [[], list [Span ]]] = None
120120
121121 @staticmethod
122122 def register_current_span_provider (
@@ -279,7 +279,7 @@ def get_external_current_span() -> Optional[Span]:
279279 return None
280280
281281 @staticmethod
282- def get_ancestor_spans () -> List [Span ]:
282+ def get_ancestor_spans () -> list [Span ]:
283283 """Get the ancestor spans from the registered provider, if any."""
284284 if UiPathSpanUtils ._current_span_ancestors_provider is not None :
285285 try :
@@ -290,7 +290,7 @@ def get_ancestor_spans() -> List[Span]:
290290
291291 @staticmethod
292292 def register_current_span_ancestors_provider (
293- current_span_ancestors_provider : Optional [Callable [[], List [Span ]]],
293+ current_span_ancestors_provider : Optional [Callable [[], list [Span ]]],
294294 ):
295295 """Register a custom current span ancestors provider function.
296296
0 commit comments