Skip to content
This repository was archived by the owner on Mar 4, 2026. It is now read-only.

Commit 99c78e6

Browse files
committed
feat(tracing): add current span ancestors provider
1 parent 4fe91ff commit 99c78e6

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

src/uipath/core/tracing/manager.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Tracing manager for handling tracer implementations and function registry."""
22

33
import logging
4-
from typing import Any, Callable, Optional
4+
from typing import Any, Callable, List, Optional
55

66
from opentelemetry import context, trace
77
from opentelemetry.trace import set_span_in_context
@@ -13,6 +13,7 @@ class UiPathTracingManager:
1313
"""Static utility class to manage tracing implementations and decorated functions."""
1414

1515
_current_span_provider: Optional[Callable[[], Any]] = None
16+
_current_span_ancestors_provider: Optional[Callable[[], List[Any]]] = None
1617

1718
@classmethod
1819
def register_current_span_provider(
@@ -55,5 +56,23 @@ def get_parent_context():
5556

5657
return ctx
5758

59+
@classmethod
60+
def register_current_span_ancestors_provider(
61+
cls, current_span_ancestors_provider: Optional[Callable[[], List[Any]]]
62+
):
63+
"""Register a custom current span ancestors provider function.
64+
65+
Args:
66+
current_span_ancestors_provider: A function that returns a list of ancestor spans
67+
from an external tracing framework. If None, no custom
68+
span ancestor information will be used.
69+
"""
70+
cls._current_span_ancestors_provider = current_span_ancestors_provider
71+
72+
@classmethod
73+
def get_current_span_ancestors_provider(cls):
74+
"""Get the currently set custom span ancestors provider."""
75+
return cls._current_span_ancestors_provider
76+
5877

5978
__all__ = ["UiPathTracingManager"]

0 commit comments

Comments
 (0)